MCPcopy
hub / github.com/nats-io/nats.go / TestAckForNonJetStream

Function TestAckForNonJetStream

test/js_test.go:2371–2390  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2369}
2370
2371func TestAckForNonJetStream(t *testing.T) {
2372 s := RunBasicJetStreamServer()
2373 defer shutdownJSServerAndRemoveStorage(t, s)
2374
2375 nc, err := nats.Connect(s.ClientURL())
2376 if err != nil {
2377 t.Fatalf("Unexpected error: %v", err)
2378 }
2379 defer nc.Close()
2380
2381 sub, _ := nc.SubscribeSync("foo")
2382 nc.PublishRequest("foo", "_INBOX_", []byte("OK"))
2383 m, err := sub.NextMsg(time.Second)
2384 if err != nil {
2385 t.Fatalf("Unexpected error: %v", err)
2386 }
2387 if err := m.Ack(); err != nil {
2388 t.Fatalf("Expected no errors, got '%v'", err)
2389 }
2390}
2391
2392func TestJetStreamManagement(t *testing.T) {
2393 conf := createConfFile(t, []byte(`

Callers

nothing calls this directly

Calls 9

ConnectMethod · 0.80
FatalfMethod · 0.80
NextMsgMethod · 0.80
RunBasicJetStreamServerFunction · 0.70
SubscribeSyncMethod · 0.65
AckMethod · 0.65
CloseMethod · 0.45
PublishRequestMethod · 0.45

Tested by

no test coverage detected