diff --git a/.github/workflows/branch-build.yml b/.github/workflows/branch-build.yml index 7878057c90..0e2ce33374 100644 --- a/.github/workflows/branch-build.yml +++ b/.github/workflows/branch-build.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - fix-cloud-slack-tests # TODO: Remove repository_dispatch: types: [ trigger-e2e-tests ] 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 ac4014268c..499a9ac710 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 @@ -267,7 +267,7 @@ func TestCloudSlackE2E(t *testing.T) { require.NotEmpty(t, authHeaderValue, "Previous subtest needs to pass to get authorization header value") t.Log("Initializing Slack...") - tester, err := commplatform.NewSlackTester(cfg.Slack.Tester) + tester, err := commplatform.NewSlackTester(cfg.Slack.Tester, nil) require.NoError(t, err) t.Log("Initializing users...") diff --git a/test/commplatform/slack_tester.go b/test/commplatform/slack_tester.go index f99c707b73..e66a4b2ba2 100644 --- a/test/commplatform/slack_tester.go +++ b/test/commplatform/slack_tester.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/kubeshop/botkube/internal/ptr" "regexp" "strings" "testing" @@ -75,11 +76,12 @@ func (s *SlackTester) ReplaceBotNamePlaceholder(msg *interactive.CoreMessage, cl msg.ReplaceBotNamePlaceholder(s.BotName(), api.BotNameWithClusterName(clusterName)) } -func NewSlackTester(slackCfg SlackConfig, apiKey string) (BotDriver, error) { +func NewSlackTester(slackCfg SlackConfig, apiKey *string) (BotDriver, error) { var token string if slackCfg.TesterAppToken == "" && slackCfg.TesterBotToken == "" && slackCfg.CloudTesterAppToken == "" { return nil, errors.New("slack tester tokens are not set") } + if slackCfg.TesterAppToken != "" { token = slackCfg.TesterAppToken } @@ -98,7 +100,7 @@ func NewSlackTester(slackCfg SlackConfig, apiKey string) (BotDriver, error) { mdFormatter := interactive.NewMDFormatter(interactive.NewlineFormatter, func(msg string) string { return fmt.Sprintf("*%s*", msg) }) - return &SlackTester{cli: slackCli, cfg: slackCfg, mdFormatter: mdFormatter, configProviderApiKey: apiKey}, nil + return &SlackTester{cli: slackCli, cfg: slackCfg, mdFormatter: mdFormatter, configProviderApiKey: ptr.ToValue(apiKey)}, nil } func (s *SlackTester) InitUsers(t *testing.T) {