Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smoke test for discord-bot.py #24

Merged
merged 3 commits into from
Nov 19, 2024
Merged

Add smoke test for discord-bot.py #24

merged 3 commits into from
Nov 19, 2024

Conversation

b9r5
Copy link
Collaborator

@b9r5 b9r5 commented Nov 16, 2024

Adds a smoke test script that checks message thread contents for happy path messages.

Tested with this thread on my Discord server:

python3 tests/discord-bot-smoke-test.py \ 
  https://discord.com/channels/1304323138586411018/1304323139093794868/1307454882684342323

and this job:
https://github.com/gpu-mode/discord-cluster-manager/actions/runs/11873319052

$ python3 tests/discord-bot-smoke-test.py https://discord.com/channels/1304323138586411018/1304323139093794868/1307454882684342323
2024-11-16 13:22:38 - INFO - Running smoke tests...
2024-11-16 13:22:38 INFO     discord.client logging in using static token
2024-11-16 13:22:38 - INFO - logging in using static token
2024-11-16 13:22:39 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 526a0979df66540fcfed9900f98938d5).
2024-11-16 13:22:39 - INFO - Shard ID None has connected to Gateway (Session ID: 526a0979df66540fcfed9900f98938d5).
2024-11-16 13:22:42 - INFO - Found thread: Training Job - 2024-11-16 13:18.
2024-11-16 13:22:42 - INFO - All required strings were found in the thread.
2024-11-16 13:22:42 - INFO - All tests passed!

And when tested on a thread that does not have all required strings:

$ python3 tests/discord-bot-smoke-test.py https://discord.com/channels/1304323138586411018/1304323139093794868/1307431944581287936
2024-11-16 13:53:18 - INFO - Running smoke tests...
2024-11-16 13:53:18 INFO     discord.client logging in using static token
2024-11-16 13:53:18 - INFO - logging in using static token
2024-11-16 13:53:19 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 731d35c6a05672491bf14021b9e1c641).
2024-11-16 13:53:19 - INFO - Shard ID None has connected to Gateway (Session ID: 731d35c6a05672491bf14021b9e1c641).
2024-11-16 13:53:21 - INFO - Found thread: asdf.
2024-11-16 13:53:22 - WARNING - Some required string was not found in the thread!
2024-11-16 13:53:22 - INFO - Thread contents were: 
2024-11-16 13:53:22 - INFO -    zxcv

2024-11-16 13:53:22 - WARNING - One or more tests failed!

@b9r5 b9r5 marked this pull request as ready for review November 16, 2024 21:54
@b9r5 b9r5 marked this pull request as draft November 18, 2024 16:21
@b9r5
Copy link
Collaborator Author

b9r5 commented Nov 18, 2024

I modified the smoke test script to send a smoke test message and listen for responses. This saves the user the trouble of having to find a message link for input to the smoke test script. I also made the script suitable for use in a PR flow.

@b9r5 b9r5 marked this pull request as ready for review November 19, 2024 15:29
@msaroufim msaroufim merged commit de57346 into main Nov 19, 2024
1 check passed
@b9r5 b9r5 deleted the benh/smoke-test branch November 20, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants