botkube
botkube copied to clipboard
Support Both RTM and WS
Description
⚠️ Since there are changes on ci pipeline, there will be always failure until we merge to main. Check testing part to test locally 👇 Changes proposed in this pull request:
- Now Botkube supports both RTM and Websocket
- Interactive messages are still in codebase, and tests are refactored accordingly
- CI pipelines are fixed according to RTM and websocket support
Testing
Now we support Slack and Socket Slack, you can test it with different configurations as shown below.
Manual testing:
- Checkout this branch:
gh pr checkout 737
- Create cluster:
k3d cluster create
- Install BotKube with Slack:
# /tmp/slack.yaml
communications:
default-group:
slack:
channels:
default:
name: botkube-demo
enabled: true
token: "xoxb-..."
image:
repository: kubeshop/pr/botkube
pullPolicy: Always
tag: 737-PR
analytics:
disable: true
executors:
kubectl-read-only:
kubectl:
enabled: true
helm upgrade botkube --install --namespace botkube ./helm/botkube --create-namespace -f /tmp/slack.yaml
- After you test basic interactions, now you can test socket slack.
- Install BotKube with SocketSlack:
# /tmp/socketslack.yaml
communications:
default-group:
socketSlack:
channels:
default:
name: botkube-demo
enabled: true
appToken: "xapp-1-..."
botToken: "xoxb-..."
image:
repository: kubeshop/pr/botkube
pullPolicy: Always
tag: 737-PR
analytics:
disable: true
executors:
kubectl-read-only:
kubectl:
enabled: true
helm upgrade botkube --install --namespace botkube ./helm/botkube --create-namespace -f /tmp/socketslack.yaml
Related issue(s)
About to run the code locally.
Tested locally - works ok.
@ezodude I addressed comments and re-ran locally 👇
λ huseyin [github/kubeshop/botkube] at rtm-ws-together ✔
→ make test-integration-slack [b3be18e]
Checking system information
GOOS: darwin
GOARCH: arm64
System information checks passed.
=== RUN TestSlack
bots_test.go:85: Loading configuration...
bots_test.go:134: Creating API client with provided token for slack...
bots_test.go:138: Creating K8s client...
bots_test.go:144: Setting up test slack setup...
slack_driver_test.go:267: Getting users...
slack_driver_test.go:271: Finding user ID by name "botkube"...
slack_driver_test.go:267: Getting users...
slack_driver_test.go:271: Finding user ID by name "huseyine2etester"...
slack_driver_test.go:67: Creating channel "test-a4a00d16-c9b8-4f89-ba16-06b846ced4cb"...
slack_driver_test.go:67: Channel "test-a4a00d16-c9b8-4f89-ba16-06b846ced4cb" (ID: "C043GHLNKDH") created
slack_driver_test.go:70: Creating channel "test-37b0381c-2c8e-415b-9cf3-a0521e19078e"...
slack_driver_test.go:70: Channel "test-37b0381c-2c8e-415b-9cf3-a0521e19078e" (ID: "C043V9JQ2SV") created
bots_test.go:157: Posting welcome message...
slack_driver_test.go:123: Inviting bot with ID "U03TKRBUVEZ" to the channel with ID "C043V9JQ2SV"
bots_test.go:157: Posting welcome message...
slack_driver_test.go:123: Inviting bot with ID "U03TKRBUVEZ" to the channel with ID "C043GHLNKDH"
bots_test.go:161: Patching Deployment with test env variables...
bots_test.go:166: Waiting for Deployment
bots_test.go:170: Waiting for Bot message in channel...
bots_test.go:179: Running actual test cases
=== RUN TestSlack/Ping
=== RUN TestSlack/Help
=== RUN TestSlack/Filters_list
=== RUN TestSlack/Commands_list
=== RUN TestSlack/Commands_list/With_default_cluster
=== RUN TestSlack/Commands_list/With_custom_cluster_name
=== RUN TestSlack/Commands_list/With_unknown_cluster_name
bots_test.go:296: Ensuring bot didn't post anything new...
=== RUN TestSlack/Executor
=== RUN TestSlack/Executor/Get_Deployment
=== RUN TestSlack/Executor/Get_Configmap
=== RUN TestSlack/Executor/Get_forbidden_resource
=== RUN TestSlack/Executor/Specify_unknown_command
=== RUN TestSlack/Executor/Specify_invalid_command
=== RUN TestSlack/Executor/Specify_forbidden_namespace
=== RUN TestSlack/Executor/Based_on_other_bindings
=== RUN TestSlack/Executor/Based_on_other_bindings/Wait_for_Deployment_(the_2st_binding)
=== RUN TestSlack/Executor/Based_on_other_bindings/Exec_(the_3rd_binding_which_is_disabled)
=== RUN TestSlack/Executor/Based_on_other_bindings/Get_all_Pods_(the_4th_binding)
=== RUN TestSlack/Executor/Based_on_other_bindings/Get_all_Deployments_(the_4th_binding)
=== RUN TestSlack/Multi-channel_notifications
bots_test.go:420: Getting notifier status from second channel...
bots_test.go:429: Starting notifier in second channel...
bots_test.go:444: Creating ConfigMap...
bots_test.go:457: Expecting bot message in first channel...
bots_test.go:465: Ensuring bot didn't post anything new in second channel...
bots_test.go:471: Updating ConfigMap...
bots_test.go:478: Expecting bot message in all channels...
bots_test.go:486: Stopping notifier in first channel...
bots_test.go:495: Getting notifier status from second channel...
bots_test.go:504: Getting notifier status from first channel...
bots_test.go:513: Updating ConfigMap once again...
bots_test.go:520: Ensuring bot didn't post anything new on first channel...
bots_test.go:526: Expecting bot message in second channel...
bots_test.go:533: Starting notifier in first channel
bots_test.go:542: Creating and deleting ignored ConfigMap
bots_test.go:557: Ensuring bot didn't post anything new...
bots_test.go:562: Deleting ConfigMap
bots_test.go:567: Expecting bot message on first channel...
bots_test.go:575: Ensuring bot didn't post anything new in second channel...
=== RUN TestSlack/Recommendations
bots_test.go:588: Creating Pod...
bots_test.go:606: Expecting bot message...
bots_test.go:633: Cleaning up created Pod...
=== CONT TestSlack
bots_test.go:164: Restoring envs for deployment...
slack_driver_test.go:75: Archiving channel "test-37b0381c-2c8e-415b-9cf3-a0521e19078e"...
slack_driver_test.go:74: Archiving channel "test-a4a00d16-c9b8-4f89-ba16-06b846ced4cb"...
--- PASS: TestSlack (204.08s)
--- PASS: TestSlack/Ping (1.73s)
--- PASS: TestSlack/Help (2.54s)
--- PASS: TestSlack/Filters_list (1.48s)
--- PASS: TestSlack/Commands_list (34.46s)
--- PASS: TestSlack/Commands_list/With_default_cluster (1.52s)
--- PASS: TestSlack/Commands_list/With_custom_cluster_name (1.47s)
--- PASS: TestSlack/Commands_list/With_unknown_cluster_name (31.47s)
--- PASS: TestSlack/Executor (15.06s)
--- PASS: TestSlack/Executor/Get_Deployment (1.49s)
--- PASS: TestSlack/Executor/Get_Configmap (1.47s)
--- PASS: TestSlack/Executor/Get_forbidden_resource (1.49s)
--- PASS: TestSlack/Executor/Specify_unknown_command (1.49s)
--- PASS: TestSlack/Executor/Specify_invalid_command (1.48s)
--- PASS: TestSlack/Executor/Specify_forbidden_namespace (1.53s)
--- PASS: TestSlack/Executor/Based_on_other_bindings (6.11s)
--- PASS: TestSlack/Executor/Based_on_other_bindings/Wait_for_Deployment_(the_2st_binding) (1.49s)
--- PASS: TestSlack/Executor/Based_on_other_bindings/Exec_(the_3rd_binding_which_is_disabled) (1.47s)
--- PASS: TestSlack/Executor/Based_on_other_bindings/Get_all_Pods_(the_4th_binding) (1.49s)
--- PASS: TestSlack/Executor/Based_on_other_bindings/Get_all_Deployments_(the_4th_binding) (1.66s)
--- PASS: TestSlack/Multi-channel_notifications (140.28s)
--- PASS: TestSlack/Recommendations (1.27s)
PASS
ok github.com/kubeshop/botkube/test/e2e 204.609s
I would do a last minute check on the GitHub workflows to ensure all required env vars are present.
I would do a last minute check on the GitHub workflows to ensure all required env vars are present.
CI will fail anyways, since GH will not pick my changes on my fork for the gh actions. I expect to see success on upcoming prs