Skip to content

Commit

Permalink
Fix Cloud Slack Dev E2E tests after recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed Sep 28, 2023
1 parent 1cfd0cd commit d703b76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/branch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- fix-cloud-slack-tests # TODO: Remove
repository_dispatch:
types: [ trigger-e2e-tests ]

Expand Down
2 changes: 1 addition & 1 deletion test/cloud-slack-dev-e2e/cloud_slack_dev_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down
6 changes: 4 additions & 2 deletions test/commplatform/slack_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/kubeshop/botkube/internal/ptr"

Check failure on line 7 in test/commplatform/slack_tester.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `goimports`-ed (goimports)

Check failure on line 7 in test/commplatform/slack_tester.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `goimports`-ed (goimports)
"regexp"
"strings"
"testing"
Expand Down Expand Up @@ -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
}
Expand All @@ -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) {
Expand Down

0 comments on commit d703b76

Please sign in to comment.