From 707fc91a327d6973e7a2420b7dabbe38de43616a Mon Sep 17 00:00:00 2001 From: LP B Date: Wed, 13 Nov 2024 04:30:16 +0100 Subject: [PATCH] fix(edge/stacks): use default namespace when none is specified in manifest (#125) --- pkg/libstack/compose/composeplugin_test.go | 2 +- pkg/libstack/compose/status.go | 3 +-- pkg/libstack/compose/status_integration_test.go | 8 ++++---- pkg/libstack/libstack.go | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/libstack/compose/composeplugin_test.go b/pkg/libstack/compose/composeplugin_test.go index d8df2bfcb..68ba4c24a 100644 --- a/pkg/libstack/compose/composeplugin_test.go +++ b/pkg/libstack/compose/composeplugin_test.go @@ -62,7 +62,7 @@ services: require.True(t, containerExists(composeContainerName)) - waitResult := <-w.WaitForStatus(ctx, projectName, libstack.StatusCompleted, "") + waitResult := <-w.WaitForStatus(ctx, projectName, libstack.StatusCompleted) require.Empty(t, waitResult.ErrorMsg) require.Equal(t, libstack.StatusCompleted, waitResult.Status) diff --git a/pkg/libstack/compose/status.go b/pkg/libstack/compose/status.go index afbd17728..f5c3a945c 100644 --- a/pkg/libstack/compose/status.go +++ b/pkg/libstack/compose/status.go @@ -111,7 +111,7 @@ func aggregateStatuses(services []service) (libstack.Status, string) { } -func (c *ComposeDeployer) WaitForStatus(ctx context.Context, name string, status libstack.Status, _ string) <-chan libstack.WaitResult { +func (c *ComposeDeployer) WaitForStatus(ctx context.Context, name string, status libstack.Status) <-chan libstack.WaitResult { waitResultCh := make(chan libstack.WaitResult) waitResult := libstack.WaitResult{Status: status} @@ -135,7 +135,6 @@ func (c *ComposeDeployer) WaitForStatus(ctx context.Context, name string, status defer cancelFunc() containerSummaries, err = composeService.Ps(psCtx, name, api.PsOptions{All: true}) - return err }); err != nil { log.Debug(). diff --git a/pkg/libstack/compose/status_integration_test.go b/pkg/libstack/compose/status_integration_test.go index 96161a49b..bc4800cd3 100644 --- a/pkg/libstack/compose/status_integration_test.go +++ b/pkg/libstack/compose/status_integration_test.go @@ -66,7 +66,7 @@ func TestComposeProjectStatus(t *testing.T) { time.Sleep(5 * time.Second) - status, statusMessage, err := waitForStatus(w, ctx, projectName, libstack.StatusRunning, "") + status, statusMessage, err := waitForStatus(w, ctx, projectName, libstack.StatusRunning) if err != nil { t.Fatalf("[test: %s] Failed to get compose project status: %v", testCase.TestName, err) } @@ -86,7 +86,7 @@ func TestComposeProjectStatus(t *testing.T) { time.Sleep(20 * time.Second) - status, statusMessage, err = waitForStatus(w, ctx, projectName, libstack.StatusRemoved, "") + status, statusMessage, err = waitForStatus(w, ctx, projectName, libstack.StatusRemoved) if err != nil { t.Fatalf("[test: %s] Failed to get compose project status: %v", testCase.TestName, err) } @@ -102,11 +102,11 @@ func TestComposeProjectStatus(t *testing.T) { } } -func waitForStatus(deployer libstack.Deployer, ctx context.Context, stackName string, requiredStatus libstack.Status, stackFileLocation string) (libstack.Status, string, error) { +func waitForStatus(deployer libstack.Deployer, ctx context.Context, stackName string, requiredStatus libstack.Status) (libstack.Status, string, error) { ctx, cancel := context.WithTimeout(ctx, 1*time.Minute) defer cancel() - statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus, stackFileLocation) + statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus) result := <-statusCh if result.ErrorMsg == "" { return result.Status, "", nil diff --git a/pkg/libstack/libstack.go b/pkg/libstack/libstack.go index 7283f4abb..5315db601 100644 --- a/pkg/libstack/libstack.go +++ b/pkg/libstack/libstack.go @@ -16,7 +16,7 @@ type Deployer interface { Pull(ctx context.Context, filePaths []string, options Options) error Run(ctx context.Context, filePaths []string, serviceName string, options RunOptions) error Validate(ctx context.Context, filePaths []string, options Options) error - WaitForStatus(ctx context.Context, name string, status Status, stackFileLocation string) <-chan WaitResult + WaitForStatus(ctx context.Context, name string, status Status) <-chan WaitResult Config(ctx context.Context, filePaths []string, options Options) ([]byte, error) }