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

Function createGCSContainer

lib/gcpgcs/client_test.go:57–98  ·  view source on GitHub ↗

nolint:exhaustruct // WONTFIX: external struct

()

Source from the content-addressed store, hash-verified

55
56// nolint:exhaustruct // WONTFIX: external struct
57func createGCSContainer() error {
58 ctx := context.Background()
59 repoRoot, err := filepath.Abs(filepath.Join(".", "..", ".."))
60 if err != nil {
61 return err
62 }
63
64 goarch := runtime.GOARCH
65 req := testcontainers.ContainerRequest{
66 FromDockerfile: testcontainers.FromDockerfile{
67 Dockerfile: filepath.Join(".dev", "gcs", "Dockerfile"),
68 Context: repoRoot,
69 BuildArgs: map[string]*string{"TARGETARCH": &goarch},
70 KeepImage: true,
71 },
72 ExposedPorts: []string{"4443/tcp"},
73 WaitingFor: wait.ForListeningPort("4443/tcp"),
74 Name: "webstatus-dev-test-gcs",
75 // Needed because of https://github.com/fsouza/fake-gcs-server/issues/982
76 Cmd: []string{"-scheme", "http", "-public-host", "localhost", "-backend", "memory"},
77 }
78 gcsContainer, 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 := gcsContainer.MappedPort(ctx, "4443")
87 if err != nil {
88 return err
89 }
90
91 gcsHost = fmt.Sprintf("localhost:%s", mappedPort.Port())
92 err = newTestGCSClient()
93 if err != nil {
94 return err
95 }
96
97 return nil
98}
99
100func newTestGCSClient() error {
101 var err error

Callers 1

TestMainFunction · 0.85

Calls 1

newTestGCSClientFunction · 0.85

Tested by

no test coverage detected