Add bot startup test to prevent deploying unstartable bots#84
Open
Add bot startup test to prevent deploying unstartable bots#84
Conversation
There was a problem hiding this comment.
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 <51587867+rhamenator@users.noreply.github.com>
Co-authored-by: rhamenator <51587867+rhamenator@users.noreply.github.com>
Co-authored-by: rhamenator <51587867+rhamenator@users.noreply.github.com>
Co-authored-by: rhamenator <51587867+rhamenator@users.noreply.github.com>
Co-authored-by: rhamenator <51587867+rhamenator@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add test to ensure bot starts successfully
Add bot startup test to prevent deploying unstartable bots
Oct 14, 2025
Member
|
Please let me know when you are able to verify these changes locally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.