(t *testing.T, h *Harness, ctx context.Context, bundlePath string)
| 269 | } |
| 270 | |
| 271 | func startBundleRepo(t *testing.T, h *Harness, ctx context.Context, bundlePath string) testcontainers.Container { |
| 272 | t.Helper() |
| 273 | repoReq := testcontainers.ContainerRequest{ |
| 274 | Image: "python:3-alpine", |
| 275 | Cmd: []string{"sh", "-c", "mkdir -p /data && cd /data && python3 -u -m http.server 80"}, |
| 276 | ExposedPorts: []string{"80/tcp"}, |
| 277 | Networks: []string{h.Network.Name}, |
| 278 | NetworkAliases: map[string][]string{ |
| 279 | h.Network.Name: {"repo"}, |
| 280 | }, |
| 281 | WaitingFor: wait.ForListeningPort("80/tcp"), |
| 282 | } |
| 283 | repoContainer, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ |
| 284 | ContainerRequest: repoReq, |
| 285 | Started: true, |
| 286 | }) |
| 287 | if err != nil { |
| 288 | t.Fatal(err) |
| 289 | } |
| 290 | t.Cleanup(func() { |
| 291 | repoContainer.Terminate(context.Background()) |
| 292 | }) |
| 293 | if err := repoContainer.CopyFileToContainer(ctx, bundlePath, "/data/bundle", 0644); err != nil { |
| 294 | t.Fatal(err) |
| 295 | } |
| 296 | return repoContainer |
| 297 | } |
| 298 | |
| 299 | func writeBundle(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey) (string, int64) { |
| 300 | t.Helper() |
no test coverage detected