Skip to content

Commit

Permalink
Merge branch 'release/v0.3.0'
Browse files Browse the repository at this point in the history
* release/v0.3.0:
  fix: wrong type of extra in Put method and check it correctly
  • Loading branch information
buraksezer committed Dec 9, 2020
2 parents 258c655 + e1990cd commit 4e51876
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/dmap.go
Expand Up @@ -88,7 +88,7 @@ func (d *DMap) Put(key string, value interface{}) error {
req.SetDMap(d.name)
req.SetKey(key)
req.SetValue(data)
req.SetExtra(protocol.PutExExtra{
req.SetExtra(protocol.PutExtra{
Timestamp: time.Now().UnixNano(),
})
resp, err := d.request(req)
Expand Down
16 changes: 16 additions & 0 deletions client/dmap_test.go
Expand Up @@ -141,6 +141,22 @@ func TestClient_Put(t *testing.T) {
if val.(string) != value {
t.Fatalf("Expected value %s. Got: %s", val.(string), value)
}

t.Run("check olric.Entry fields", func(t *testing.T) {
entry, err := dm.GetEntry(key)
if err != nil {
t.Fatalf("Expected nil. Got: %v", err)
}
if entry.Value.(string) != value {
t.Fatalf("Expected value %s. Got: %s", entry.Value.(string), value)
}
if entry.Timestamp == 0 {
t.Fatalf("Timestamp is invalid")
}
if entry.TTL != 0 {
t.Fatalf("TTL is invalid")
}
})
}

func TestClient_PutEx(t *testing.T) {
Expand Down

0 comments on commit 4e51876

Please sign in to comment.