1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 22:09:41 +02:00

feat(edge): kubernetes WaitForStatus support (#85)

This commit is contained in:
LP B 2024-11-11 14:02:20 +01:00 committed by GitHub
parent fd2b00bf3b
commit 6bc52dd39c
6 changed files with 34 additions and 8 deletions

View file

@ -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) (libstack.Status, string, error) {
func waitForStatus(deployer libstack.Deployer, ctx context.Context, stackName string, requiredStatus libstack.Status, stackFileLocation string) (libstack.Status, string, error) {
ctx, cancel := context.WithTimeout(ctx, 1*time.Minute)
defer cancel()
statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus)
statusCh := deployer.WaitForStatus(ctx, stackName, requiredStatus, stackFileLocation)
result := <-statusCh
if result.ErrorMsg == "" {
return result.Status, "", nil