Skip to content

Commit

Permalink
CreateKeyValue with RePublish will fail if KV already exists
Browse files Browse the repository at this point in the history
This cannot be updated in the server at the moment, so if user
calls CreateKeyValue() with a config that does not have RePublish
and then call again on the same bucket with RePublish set, the
user will get an error. Added a test that shows that this is the case.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
  • Loading branch information
kozlovic committed Aug 3, 2022
1 parent ff4ed92 commit 0c1bf3e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kv_test.go
Expand Up @@ -120,6 +120,22 @@ func TestKeyValueRePublish(t *testing.T) {
defer nc.Close()

kv, err := js.CreateKeyValue(&KeyValueConfig{
Bucket: "TEST_UPDATE",
})
if err != nil {
t.Fatalf("Error creating store: %v", err)
}
// This is expected to fail since server does not support as of now
// the update of RePublish.
kv, err = js.CreateKeyValue(&KeyValueConfig{
Bucket: "TEST_UPDATE",
RePublish: &RePublish{Source: ">", Destination: "bar.>"},
})
if err == nil {
t.Fatal("Expected failure, did not get one")
}

kv, err = js.CreateKeyValue(&KeyValueConfig{
Bucket: "TEST",
RePublish: &RePublish{Source: ">", Destination: "bar.>"},
})
Expand Down

0 comments on commit 0c1bf3e

Please sign in to comment.