From b2e12d41e46a7a4615c2687fe83dba86541cd656 Mon Sep 17 00:00:00 2001 From: Pawel Kosiec Date: Fri, 8 Mar 2024 13:09:07 +0100 Subject: [PATCH] Do not uninstall Botkube on test failure --- .../cloud_slack_dev_e2e_test.go | 9 +++++++-- test/e2e/bots_test.go | 19 +++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go b/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go index 52d688444..f5b24f59c 100644 --- a/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go +++ b/test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go @@ -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) }) diff --git a/test/e2e/bots_test.go b/test/e2e/bots_test.go index 23a29e393..c0f3b34d2 100644 --- a/test/e2e/bots_test.go +++ b/test/e2e/bots_test.go @@ -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) }) } @@ -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) }