MCPcopy Create free account
hub / github.com/google/go-cloud / TestOpenTopicFromURL

Function TestOpenTopicFromURL

pubsub/mempubsub/mem_test.go:79–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestOpenTopicFromURL(t *testing.T) {
80 tests := []struct {
81 URL string
82 WantErr bool
83 }{
84 // OK.
85 {"mem://mytopic", false},
86 // Invalid parameter.
87 {"mem://mytopic?param=value", true},
88 }
89
90 ctx := context.Background()
91 for _, test := range tests {
92 topic, err := pubsub.OpenTopic(ctx, test.URL)
93 if (err != nil) != test.WantErr {
94 t.Errorf("%s: got error %v, want error %v", test.URL, err, test.WantErr)
95 }
96 if topic != nil {
97 topic.Shutdown(ctx)
98 }
99 }
100}
101
102func TestOpenSubscriptionFromURL(t *testing.T) {
103 tests := []struct {

Callers

nothing calls this directly

Calls 2

OpenTopicFunction · 0.92
ShutdownMethod · 0.65

Tested by

no test coverage detected