MCPcopy Create free account
hub / github.com/encodeous/nylon / startBundleRepo

Function startBundleRepo

e2e/distribution_test.go:271–297  ·  view source on GitHub ↗
(t *testing.T, h *Harness, ctx context.Context, bundlePath string)

Source from the content-addressed store, hash-verified

269}
270
271func 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
299func writeBundle(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey) (string, int64) {
300 t.Helper()

Callers 1

Calls 1

CleanupMethod · 0.45

Tested by

no test coverage detected