Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslopezf committed Feb 2, 2024
1 parent c6d0b82 commit df61121
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions znats/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@ import (
"github.com/nats-io/nats.go"
"gotest.tools/assert"
"testing"
"time"
)

func TestNatsPing(t *testing.T) {
nc, err := nats.Connect("nats://localhost:4222")
if err != nil {
t.Fatalf("Error connecting to nats: %v", err)
}
defer nc.Close()

response, err := nc.Request("ping", []byte("ping"), 1000*time.Millisecond)
if err != nil {
t.Fatalf("error sending ping: %v", err)
}

if string(response.Data) != "pong" {
t.Fatalf("wrong answer: %s", response.Data)
}
}

func TestCreateKVStore(t *testing.T) {
bucketNameHandle := "testKVStore"
err := natsComponent.CreateKVStore(ConfigKVStore{
Expand Down

0 comments on commit df61121

Please sign in to comment.