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

Function createDatabaseContainer

lib/gcpspanner/client_test.go:62–101  ·  view source on GitHub ↗

nolint:exhaustruct // WONTFIX: external struct

()

Source from the content-addressed store, hash-verified

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

Callers 1

TestMainFunction · 0.85

Calls 1

newTestSpannerClientFunction · 0.85

Tested by

no test coverage detected