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

Function TestCompatibilityObjectStoreDefaultBucket

test/compat_test.go:45–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func TestCompatibilityObjectStoreDefaultBucket(t *testing.T) {
46 t.Parallel()
47 nc := connect(t)
48 js, err := jetstream.New(nc)
49 if err != nil {
50 t.Fatalf("Error connecting to NATS: %v", err)
51 }
52 defer nc.Close()
53
54 // setup subscription on which tester will be sending requests
55 sub, err := nc.SubscribeSync("tests.object-store.default-bucket.>")
56 if err != nil {
57 t.Fatalf("Error subscribing to test subject: %v", err)
58 }
59 defer sub.Unsubscribe()
60
61 // 1. Create default bucket
62 msg, err := sub.NextMsg(1 * time.Hour)
63 if err != nil {
64 t.Fatalf("Error getting message: %v", err)
65 }
66
67 ctx := context.Background()
68
69 _, err = js.CreateObjectStore(ctx, jetstream.ObjectStoreConfig{
70 Bucket: "test",
71 })
72 if err != nil {
73 t.Fatalf("Error creating object store: %v", err)
74 }
75 // send empty response to indicate client is done
76 if err := msg.Respond(nil); err != nil {
77 t.Fatalf("Error responding to message: %v", err)
78 }
79 validateTestResult(t, sub)
80}
81
82func TestCompatibilityObjectStoreCustomBucket(t *testing.T) {
83 t.Parallel()

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
connectFunction · 0.85
validateTestResultFunction · 0.85
FatalfMethod · 0.80
UnsubscribeMethod · 0.80
NextMsgMethod · 0.80
SubscribeSyncMethod · 0.65
CreateObjectStoreMethod · 0.65
RespondMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected