From d9d2e9870c6a310735c4b7228ba63eb8acfe13f1 Mon Sep 17 00:00:00 2001 From: Justin Alvarez Date: Tue, 26 Mar 2024 12:46:03 -0400 Subject: [PATCH] fix: stale global variable Signed-off-by: Justin Alvarez --- tests/compose_logs.go | 4 +++- tests/compose_ps.go | 4 +++- tests/compose_pull.go | 4 +++- tests/tests.go | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/compose_logs.go b/tests/compose_logs.go index 8d63aa3..1953cc1 100644 --- a/tests/compose_logs.go +++ b/tests/compose_logs.go @@ -19,12 +19,14 @@ import ( func ComposeLogs(o *option.Option) { services := []string{"svc1_compose_logs", "svc2_compose_logs"} containerNames := []string{"container1_compose_logs", "container2_compose_logs"} - imageNames := []string{localImages[defaultImage], localImages[defaultImage]} ginkgo.Describe("Compose logs command", func() { var buildContext string var composeFilePath string + var imageNames []string + ginkgo.BeforeEach(func() { + imageNames = []string{localImages[defaultImage], localImages[defaultImage]} command.RemoveAll(o) buildContext, composeFilePath = createComposeYmlForLogsCmd(services, imageNames, containerNames) ginkgo.DeferCleanup(os.RemoveAll, buildContext) diff --git a/tests/compose_ps.go b/tests/compose_ps.go index 3440f5d..6e7bea4 100644 --- a/tests/compose_ps.go +++ b/tests/compose_ps.go @@ -19,12 +19,14 @@ import ( func ComposePs(o *option.Option) { services := []string{"svc1_compose_ps", "svc2_compose_ps"} containerNames := []string{"container1_compose_ps", "container2_compose_ps"} - imageNames := []string{localImages[defaultImage], localImages[defaultImage]} ginkgo.Describe("Compose ps command", func() { var composeContext string var composeFilePath string + var imageNames []string + ginkgo.BeforeEach(func() { + imageNames = []string{localImages[defaultImage], localImages[defaultImage]} command.RemoveAll(o) composeContext, composeFilePath = createComposeYmlForPsCmd(services, imageNames, containerNames) ginkgo.DeferCleanup(os.RemoveAll, composeContext) diff --git a/tests/compose_pull.go b/tests/compose_pull.go index d4f8b68..dd0dcbc 100644 --- a/tests/compose_pull.go +++ b/tests/compose_pull.go @@ -18,11 +18,13 @@ import ( // ComposePull tests functionality of `compose pull` command. func ComposePull(o *option.Option) { services := []string{"svc1_compose_pull", "svc2_compose_pull"} - imageNames := []string{localImages[defaultImage], localImages[olderAlpineImage]} ginkgo.Describe("Compose pull command", func() { var composeContext string var composeFilePath string + var imageNames []string + ginkgo.BeforeEach(func() { + imageNames = []string{localImages[defaultImage], localImages[olderAlpineImage]} command.RemoveAll(o) composeContext, composeFilePath = createComposeYmlForPullCmd(services, imageNames) ginkgo.DeferCleanup(os.RemoveAll, composeContext) diff --git a/tests/tests.go b/tests/tests.go index 56d667c..dc54b17 100644 --- a/tests/tests.go +++ b/tests/tests.go @@ -98,7 +98,9 @@ func SetupLocalRegistry(o *option.Option) { // split image tag according to spec // https://github.com/distribution/distribution/blob/d0deff9cd6c2b8c82c6f3d1c713af51df099d07b/reference/reference.go _, name, _ := strings.Cut(ref, "/") - command.Run(o, "pull", ref) + // allow up to a minute for remote pulls to account for external network + // latency/throughput issues or throttling (default is 10 seconds) + command.New(o, "pull", ref).WithTimeoutInSeconds(60).Run() localRef := fmt.Sprintf("localhost:%d/%s", hostPort, name) command.Run(o, "tag", ref, localRef) command.Run(o, "push", localRef)