Skip to content

Commit

Permalink
Fixed linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <[email protected]>
  • Loading branch information
piotrpio committed Aug 15, 2023
1 parent 6fbc297 commit 29f6aee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ issues:
- linters:
- errcheck
text: "msg.Ack"
- linters:
- errcheck
text: "watcher.Stop"
33 changes: 21 additions & 12 deletions jetstream/test/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,27 +209,36 @@ func TestKeyValueWatch(t *testing.T) {
// Make sure we already got an initial value marker.
expectInitDone()

kv.Create(ctx, "name", []byte("derek"))
_, err = kv.Create(ctx, "name", []byte("derek"))
expectOk(t, err)
expectUpdate("name", "derek", 1)
kv.Put(ctx, "name", []byte("rip"))
_, err = kv.Put(ctx, "name", []byte("rip"))
expectOk(t, err)
expectUpdate("name", "rip", 2)
kv.Put(ctx, "name", []byte("ik"))
_, err = kv.Put(ctx, "name", []byte("ik"))
expectOk(t, err)
expectUpdate("name", "ik", 3)
kv.Put(ctx, "age", []byte("22"))
_, err = kv.Put(ctx, "age", []byte("22"))
expectOk(t, err)
expectUpdate("age", "22", 4)
kv.Put(ctx, "age", []byte("33"))
_, err = kv.Put(ctx, "age", []byte("33"))
expectOk(t, err)
expectUpdate("age", "33", 5)
kv.Delete(ctx, "age")
expectOk(t, kv.Delete(ctx, "age"))
expectDelete("age", 6)

// Stop first watcher.
watcher.Stop()

// Now try wildcard matching and make sure we only get last value when starting.
kv.Put(ctx, "t.name", []byte("rip"))
kv.Put(ctx, "t.name", []byte("ik"))
kv.Put(ctx, "t.age", []byte("22"))
kv.Put(ctx, "t.age", []byte("44"))
_, err = kv.Put(ctx, "t.name", []byte("rip"))
expectOk(t, err)
_, err = kv.Put(ctx, "t.name", []byte("ik"))
expectOk(t, err)
_, err = kv.Put(ctx, "t.age", []byte("22"))
expectOk(t, err)
_, err = kv.Put(ctx, "t.age", []byte("44"))
expectOk(t, err)

watcher, err = kv.Watch(ctx, "t.*")
expectOk(t, err)
Expand Down Expand Up @@ -382,7 +391,7 @@ func TestKeyValueDeleteVsPurge(t *testing.T) {
put("name", "rip")
put("age", "44")

kv.Delete(ctx, "age")
expectOk(t, kv.Delete(ctx, "age"))
entries, err := kv.History(ctx, "age")
expectOk(t, err)
// Expect three entries and delete marker.
Expand Down Expand Up @@ -775,7 +784,7 @@ func TestKeyValueDuplicatesWindow(t *testing.T) {

_, err := js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: "TEST", History: 5, TTL: ttl})
expectOk(t, err)
defer js.DeleteKeyValue(ctx, "TEST")
defer expectOk(t, js.DeleteKeyValue(ctx, "TEST"))

si, err := js.Stream(ctx, "KV_TEST")
if err != nil {
Expand Down

0 comments on commit 29f6aee

Please sign in to comment.