Skip to content

Commit

Permalink
Do not uninstall Botkube on test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed Mar 8, 2024
1 parent 89eb7b4 commit b2e12d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
9 changes: 7 additions & 2 deletions test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,13 @@ func TestCloudSlackE2E(t *testing.T) {
}
helmInstallCallback := helmx.InstallChart(t, params)
t.Cleanup(func() {
t.Log("Uninstalling Helm chart...")
helmInstallCallback(t)
if t.Failed() {
t.Log("Tests failed, keeping the Botkube instance installed for debugging purposes.")
} else {
t.Log("Uninstalling Helm chart...")
helmInstallCallback(t)
}

botkubeDeploymentUninstalled.Store(true)
})

Expand Down
19 changes: 9 additions & 10 deletions test/e2e/bots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,13 @@ func runBotTest(t *testing.T,
})
require.NoError(t, err)
t.Cleanup(func() {
t.Log("Uninstalling Helm chart...")
botkubex.Uninstall(t, appCfg.ConfigProvider.BotkubeCliBinaryPath)
if t.Failed() {
t.Log("Tests failed, keeping the Botkube instance installed for debugging purposes.")
} else {
t.Log("Uninstalling Helm chart...")
botkubex.Uninstall(t, appCfg.ConfigProvider.BotkubeCliBinaryPath)
}

botkubeDeploymentUninstalled.Store(true)
})
}
Expand Down Expand Up @@ -1696,14 +1701,8 @@ func waitForRestart(t *testing.T, tester commplatform.BotDriver, userID, channel
}
}

err := tester.OnChannel().WaitForMessagePosted(userID, channel, 2, assertFn)
if err != nil && tester.Type() == commplatform.TeamsBot {
// TODO(https://github.com/kubeshop/botkube-cloud/issues/854): for some reason, Teams restarts are not deterministic and sometimes it doesn't happen
// We should add fetching Agent logs to see why it happens.
t.Logf("⚠️ Teams communication platform didn't restart on time: %v", err)
} else {
assert.NoError(t, err)
}
err := tester.OnChannel().WaitForMessagePosted(userID, channel, 3, assertFn)
assert.NoError(t, err)

tester.SetTimeout(originalTimeout)
}
Expand Down

0 comments on commit b2e12d4

Please sign in to comment.