From ce9e92b17d50200a61cbc250fb5ebbd3141b9fa9 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 19 Jun 2024 15:02:35 +0200 Subject: [PATCH] Skip already enabled notif for Teams --- test/e2e/bots_test.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/e2e/bots_test.go b/test/e2e/bots_test.go index f66f366d9..b41a723f5 100644 --- a/test/e2e/bots_test.go +++ b/test/e2e/bots_test.go @@ -853,17 +853,19 @@ func runBotTest(t *testing.T, err = botDriver.WaitForLastMessageEqual(botDriver.BotUserID(), botDriver.SecondChannel().ID(), expectedMessage) assert.NoError(t, err) - t.Log("Starting notifier in second channel...") - command = "enable notifications" - expectedBody = codeBlock(fmt.Sprintf("Brace yourselves, incoming notifications from cluster '%s'.", appCfg.ClusterName)) - expectedMessage = fmt.Sprintf("%s\n%s", cmdHeader(command), expectedBody) + if botDriver.Type() != commplatform.TeamsBot { // base on the previous assertion, we know that notifications are enabled + t.Log("Starting notifier in second channel...") + command = "enable notifications" + expectedBody = codeBlock(fmt.Sprintf("Brace yourselves, incoming notifications from cluster '%s'.", appCfg.ClusterName)) + expectedMessage = fmt.Sprintf("%s\n%s", cmdHeader(command), expectedBody) - botDriver.PostMessageToBot(t, botDriver.SecondChannel().Identifier(), command) - err = botDriver.WaitForMessagePosted(botDriver.BotUserID(), botDriver.SecondChannel().ID(), limitMessages(), botDriver.AssertEquals(expectedMessage)) - require.NoError(t, err) + botDriver.PostMessageToBot(t, botDriver.SecondChannel().Identifier(), command) + err = botDriver.WaitForMessagePosted(botDriver.BotUserID(), botDriver.SecondChannel().ID(), limitMessages(), botDriver.AssertEquals(expectedMessage)) + require.NoError(t, err) - if botDriver.Type().IsCloud() { - waitForRestart(t, botDriver, botDriver.BotUserID(), botDriver.FirstChannel().ID(), appCfg.ClusterName) + if botDriver.Type().IsCloud() { + waitForRestart(t, botDriver, botDriver.BotUserID(), botDriver.FirstChannel().ID(), appCfg.ClusterName) + } } cfgMapCli := k8sCli.CoreV1().ConfigMaps(appCfg.Deployment.Namespace)