|
|
@ -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
|
|
|
|