MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / createPubSubContainer

Function createPubSubContainer

lib/gcppubsub/client_test.go:59–98  ·  view source on GitHub ↗

nolint:exhaustruct // WONTFIX: external struct

()

Source from the content-addressed store, hash-verified

57
58// nolint:exhaustruct // WONTFIX: external struct
59func createPubSubContainer() error {
60 ctx := context.Background()
61 repoRoot, err := filepath.Abs(filepath.Join(".", "..", ".."))
62 if err != nil {
63 return err
64 }
65
66 goarch := runtime.GOARCH
67 req := testcontainers.ContainerRequest{
68 FromDockerfile: testcontainers.FromDockerfile{
69 Dockerfile: filepath.Join(".dev", "pubsub", "Dockerfile"),
70 Context: repoRoot,
71 BuildArgs: map[string]*string{"TARGETARCH": &goarch},
72 KeepImage: true,
73 },
74 ExposedPorts: []string{"8060/tcp"},
75 WaitingFor: wait.ForLog("Pub/Sub setup for webstatus.dev finished"),
76 Name: "webstatus-dev-test-pubsub",
77 }
78 pubsubContainer, err = testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
79 ContainerRequest: req,
80 Started: true,
81 })
82 if err != nil {
83 return err
84 }
85
86 mappedPort, err := pubsubContainer.MappedPort(ctx, "8060")
87 if err != nil {
88 return err
89 }
90
91 pubsubHost = fmt.Sprintf("localhost:%s", mappedPort.Port())
92 err = newTestPubsubClient()
93 if err != nil {
94 return err
95 }
96
97 return nil
98}
99
100func newTestPubsubClient() error {
101 var err error

Callers 1

TestMainFunction · 0.85

Calls 1

newTestPubsubClientFunction · 0.85

Tested by

no test coverage detected