MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / TestCloudPubSub

Function TestCloudPubSub

pkg/events/cloud/cloud_test.go:49–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47var timeout = (1 << 10) * test.Delay
48
49func TestCloudPubSub(t *testing.T) { //nolint:paralleltest
50 events.IncludeCaller = true
51
52 taskStarter := task.StartTaskFunc(task.DefaultStartTask)
53
54 test.RunSubtest(t, test.SubtestConfig{
55 Name: "json",
56 Timeout: 10 * timeout,
57 Func: func(ctx context.Context, t *testing.T, a *assertions.Assertion) {
58 t.Helper()
59 pubsub, err := cloud.NewPubSub(ctx, taskStarter, "mem://json_events_test", "mem://json_events_test")
60 a.So(err, should.BeNil)
61 defer pubsub.Close(ctx)
62 cloud.SetContentType(pubsub, "application/json")
63 eventstest.TestBackend(ctx, t, a, pubsub)
64 },
65 })
66
67 test.RunSubtest(t, test.SubtestConfig{
68 Name: "protobuf",
69 Timeout: 10 * timeout,
70 Func: func(ctx context.Context, t *testing.T, a *assertions.Assertion) {
71 t.Helper()
72 pubsub, err := cloud.NewPubSub(ctx, taskStarter, "mem://protobuf_events_test", "mem://protobuf_events_test")
73 a.So(err, should.BeNil)
74 defer pubsub.Close(ctx)
75 cloud.SetContentType(pubsub, "application/protobuf")
76 eventstest.TestBackend(ctx, t, a, pubsub)
77 },
78 })
79}

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
StartTaskFuncFuncType · 0.92
RunSubtestFunction · 0.92
NewPubSubFunction · 0.92
SetContentTypeFunction · 0.92
TestBackendFunction · 0.92

Tested by

no test coverage detected