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

Function TestDefaultObjectStatus

test/object_test.go:172–198  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

170}
171
172func TestDefaultObjectStatus(t *testing.T) {
173 s := RunBasicJetStreamServer()
174 defer shutdownJSServerAndRemoveStorage(t, s)
175
176 nc, js := jsClient(t, s)
177 defer nc.Close()
178
179 obs, err := js.CreateObjectStore(&nats.ObjectStoreConfig{Bucket: "OBJS", Description: "testing"})
180 expectOk(t, err)
181
182 blob := make([]byte, 1024*1024+22)
183 rand.Read(blob)
184
185 _, err = obs.PutBytes("BLOB", blob)
186 expectOk(t, err)
187
188 status, err := obs.Status()
189 expectOk(t, err)
190 if status.BackingStore() != "JetStream" {
191 t.Fatalf("invalid backing store kind: %s", status.BackingStore())
192 }
193 bs := status.(*nats.ObjectBucketStatus)
194 info := bs.StreamInfo()
195 if info.Config.Name != "OBJ_OBJS" {
196 t.Fatalf("invalid stream name %+v", info)
197 }
198}
199
200func TestObjectFileBasics(t *testing.T) {
201 s := RunBasicJetStreamServer()

Callers

nothing calls this directly

Calls 12

FatalfMethod · 0.80
RunBasicJetStreamServerFunction · 0.70
jsClientFunction · 0.70
expectOkFunction · 0.70
CreateObjectStoreMethod · 0.65
PutBytesMethod · 0.65
StatusMethod · 0.65
BackingStoreMethod · 0.65
StreamInfoMethod · 0.65
CloseMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected