-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add bot startup test to prevent deploying unstartable bots #84
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: rhamenator <[email protected]>
Co-authored-by: rhamenator <[email protected]>
Co-authored-by: rhamenator <[email protected]>
Co-authored-by: rhamenator <[email protected]>
Co-authored-by: rhamenator <[email protected]>
rhamenator
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
|
Please let me know when you are able to verify these changes locally |
Problem
The current test suite validates functional capabilities but doesn't verify that the bot actually starts successfully. This creates a deployment risk where tests pass but the bot fails to start due to:
npm audit fixornpm outdatedSince the test suite must pass before deployments occur, an unstartable bot can be deployed if the tests don't catch startup failures.
Solution
Added an integration test (
spec/bot-startup-spec.js) that spawns the actual bot process and verifies successful startup:Test Implementation
Spawns the real bot process using the mock adapter with all necessary environment variables:
FIREBASE_WEB_CONFIG: Minimal Firebase configurationPATH: Includesnode_modules/.binfor CoffeeScriptNODE_ENV: Set to 'test'HUBOT_HTTPD: Disabled to prevent port conflictsMonitors startup indicators: Watches stderr for successful initialization signals (DeprecationWarning or hubot-heroku-keepalive messages)
Detects critical errors: Checks combined stdout/stderr for error patterns:
SyntaxErrorCannot find moduleUnable to loadis not valid JSONValidates graceful shutdown: Terminates the bot with SIGTERM after confirming successful startup and verifies exit code is 0 or null
Implements robust error handling:
done()from being called multiple timesWhat This Catches
The test will fail (preventing deployment) when:
npm audit fix)Testing
Impact
This test provides high confidence that if the test suite passes, the bot will start successfully in production, preventing deployments of unstartable bots.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
tinyurl.comnode /home/REDACTED/work/slackbot/slackbot/node_modules/.bin/jasmine(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #56
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.