mirror of https://github.com/portainer/portainer
fix(edge/stacks): use default namespace when none is specified in manifest (#125)
parent
b2eb4388fd
commit
707fc91a32
|
@ -62,7 +62,7 @@ services:
|
||||||
|
|
||||||
require.True(t, containerExists(composeContainerName))
|
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.Empty(t, waitResult.ErrorMsg)
|
||||||
require.Equal(t, libstack.StatusCompleted, waitResult.Status)
|
require.Equal(t, libstack.StatusCompleted, waitResult.Status)
|
||||||
|
|
|
@ -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)
|
waitResultCh := make(chan libstack.WaitResult)
|
||||||
waitResult := libstack.WaitResult{Status: status}
|
waitResult := libstack.WaitResult{Status: status}
|
||||||
|
|
||||||
|
@ -135,7 +135,6 @@ func (c *ComposeDeployer) WaitForStatus(ctx context.Context, name string, status
|
||||||
defer cancelFunc()
|
defer cancelFunc()
|
||||||
containerSummaries, err = composeService.Ps(psCtx, name, api.PsOptions{All: true})
|
containerSummaries, err = composeService.Ps(psCtx, name, api.PsOptions{All: true})
|
||||||
|
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Debug().
|
log.Debug().
|
||||||
|
|
|
@ -66,7 +66,7 @@ func TestComposeProjectStatus(t *testing.T) {
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("[test: %s] Failed to get compose project status: %v", testCase.TestName, err)
|
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)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("[test: %s] Failed to get compose project status: %v", testCase.TestName, err)
|
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)
|
ctx, cancel := context.WithTimeout(ctx, 1*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus, stackFileLocation)
|
statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus)
|
||||||
result := <-statusCh
|
result := <-statusCh
|
||||||
if result.ErrorMsg == "" {
|
if result.ErrorMsg == "" {
|
||||||
return result.Status, "", nil
|
return result.Status, "", nil
|
||||||
|
|
|
@ -16,7 +16,7 @@ type Deployer interface {
|
||||||
Pull(ctx context.Context, filePaths []string, options Options) error
|
Pull(ctx context.Context, filePaths []string, options Options) error
|
||||||
Run(ctx context.Context, filePaths []string, serviceName string, options RunOptions) error
|
Run(ctx context.Context, filePaths []string, serviceName string, options RunOptions) error
|
||||||
Validate(ctx context.Context, filePaths []string, options Options) 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)
|
Config(ctx context.Context, filePaths []string, options Options) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue