-
-
Notifications
You must be signed in to change notification settings - Fork 28
Added tests for deployment to lagoon. #1817
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
Conversation
WalkthroughA new BATS test suite for the Changes
Estimated code review effort2 (~20 minutes) Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧠 Learnings (2).vortex/tests/test.common.sh (1)Learnt from: AlexSkrypnyk .vortex/tests/bats/unit/deploy-lagoon.bats (1)Learnt from: AlexSkrypnyk 🧰 Additional context used🧠 Learnings (2).vortex/tests/test.common.sh (1)Learnt from: AlexSkrypnyk .vortex/tests/bats/unit/deploy-lagoon.bats (1)Learnt from: AlexSkrypnyk ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
🔇 Additional comments (8)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.vortex/tests/bats/unit/deploy-lagoon.bats(1 hunks)
🧠 Learnings (1)
.vortex/tests/bats/unit/deploy-lagoon.bats (1)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
🧰 Additional context used
🧠 Learnings (1)
.vortex/tests/bats/unit/deploy-lagoon.bats (1)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: build (1)
- GitHub Check: build (0)
- GitHub Check: vortex-test-deployment (0)
- GitHub Check: vortex-test-workflow (0)
- GitHub Check: vortex-test-workflow (1)
- GitHub Check: vortex-test-workflow (2)
- GitHub Check: vortex-test-deployment (1)
- GitHub Check: vortex-test-common
- GitHub Check: vortex-test-workflow (3)
- GitHub Check: vortex-test-installer (8.4)
- GitHub Check: vortex-test-installer (8.2)
- GitHub Check: vortex-test-installer (8.3)
- GitHub Check: vortex-test-docs
🔇 Additional comments (9)
.vortex/tests/bats/unit/deploy-lagoon.bats (9)
1-8: LGTM! Clean test file setup.The header follows standard BATS conventions with appropriate shellcheck disables for test scenarios.
10-28: Well-structured error validation test.The test properly validates the missing LAGOON_PROJECT scenario with clean environment setup and specific error message assertion.
30-42: Effective validation of deployment type requirements.The test correctly validates that either VORTEX_DEPLOY_BRANCH or VORTEX_DEPLOY_PR must be provided.
45-76: Comprehensive branch deployment test.The test thoroughly validates the fresh branch deployment scenario with proper SSH setup, environment configuration, and command flow verification.
78-121: Excellent coverage of redeployment with DB override.This test comprehensively validates the complex redeployment scenario including proper database override flag management and cleanup.
123-156: Thorough PR deployment test coverage.The test effectively validates the pull request deployment scenario with all required PR-specific parameters and command structure.
158-197: Well-implemented PR redeployment test.The test properly validates PR redeployment scenarios including existing environment detection and database override flag management.
199-228: Clean environment destruction test.The test effectively validates the environment destruction scenario with proper command structure and flow.
1-230: Excellent test suite with comprehensive coverage.This BATS test suite provides thorough coverage of the Lagoon deployment script with well-structured tests for error handling, branch deployments, PR deployments, redeployments with database overrides, and environment destruction. The consistent use of mocking patterns and the STEPS array approach makes the tests maintainable and readable.
15c2c3c to
b5fd560
Compare
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.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.vortex/tests/bats/unit/deploy-lagoon.bats (1)
44-44: Minor: Remove extra blank line.Consider removing this extra blank line for consistency.
-
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
.vortex/tests/bats/unit/deploy-lagoon.bats(1 hunks).vortex/tests/test.common.sh(1 hunks)
🧠 Learnings (2)
.vortex/tests/bats/unit/deploy-lagoon.bats (1)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
.vortex/tests/test.common.sh (2)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
Learnt from: AlexSkrypnyk
PR: #1697
File: .vortex/installer/tests/Fixtures/install/provision_database_lagoon/docs/onboarding.md:16-17
Timestamp: 2025-06-02T00:41:36.321Z
Learning: DO NOT EVER REVIEW FILES IN .vortex/installer/tests/Fixtures/ directory - these are test fixtures and should not be reviewed under any circumstances.
🧰 Additional context used
🧠 Learnings (2)
.vortex/tests/bats/unit/deploy-lagoon.bats (1)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
.vortex/tests/test.common.sh (2)
Learnt from: AlexSkrypnyk
PR: drevops/vortex#0
File: :0-0
Timestamp: 2025-05-29T12:15:32.188Z
Learning: Do not review files in .vortex/installer/tests/Fixtures/install directory as they are test fixtures.
Learnt from: AlexSkrypnyk
PR: #1697
File: .vortex/installer/tests/Fixtures/install/provision_database_lagoon/docs/onboarding.md:16-17
Timestamp: 2025-06-02T00:41:36.321Z
Learning: DO NOT EVER REVIEW FILES IN .vortex/installer/tests/Fixtures/ directory - these are test fixtures and should not be reviewed under any circumstances.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: build (1)
- GitHub Check: build (0)
- GitHub Check: vortex-test-deployment (0)
- GitHub Check: vortex-test-workflow (3)
- GitHub Check: vortex-test-workflow (2)
- GitHub Check: vortex-test-workflow (1)
- GitHub Check: vortex-test-workflow (0)
- GitHub Check: vortex-test-deployment (1)
- GitHub Check: vortex-test-common
- GitHub Check: vortex-test-installer (8.4)
- GitHub Check: vortex-test-installer (8.2)
- GitHub Check: vortex-test-installer (8.3)
- GitHub Check: vortex-test-docs
🔇 Additional comments (1)
.vortex/tests/test.common.sh (1)
41-47: Good test organization!The reordering of tests to run unit tests before end-to-end tests is a logical improvement. Grouping all deployment-related unit tests together also improves maintainability.
| "Redeploying environment: project test_project, branch: test-branch." | ||
| "@lagoon --force --skip-update-check --ssh-key ${HOME}/.ssh/id_rsa --lagoon amazeeio --project test_project deploy latest --environment test-branch" | ||
| "Waiting for deployment to be queued." | ||
| "@sleep 10" |
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.
🧹 Nitpick (assertive)
Consider reducing or mocking the sleep duration.
The 10-second sleep might slow down test execution. Consider whether this delay is necessary for the test, or if it could be reduced or mocked entirely.
🤖 Prompt for AI Agents
In .vortex/tests/bats/unit/deploy-lagoon.bats at line 106, the test includes a
10-second sleep which slows down execution. Evaluate if the full 10-second delay
is essential; if not, reduce the sleep duration to a shorter time.
Alternatively, mock the sleep function or replace it with a no-op during testing
to avoid unnecessary delays and speed up the test suite.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1817 +/- ##
===========================================
+ Coverage 72.61% 74.41% +1.79%
===========================================
Files 84 84
Lines 4725 4725
Branches 35 35
===========================================
+ Hits 3431 3516 +85
+ Misses 1294 1209 -85 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b5fd560 to
6f28eb6
Compare
Summary by CodeRabbit