-
Notifications
You must be signed in to change notification settings - Fork 71
fix: index tests #331
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
fix: index tests #331
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.
Pull Request Overview
This PR addresses failing tests on main by updating test configurations and workflow conditions to ensure tests run consistently.
- Updated test configuration in mongodbHelpers to include a specific MongoDB version.
- Adjusted the aggregate call in the AggregateTool by removing unused options parameters.
- Modified workflow conditionals to run tests on push events as well as pull requests.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/integration/tools/mongodb/mongodbHelpers.ts | Added MongoDB version configuration to enforce a consistent test environment. |
src/tools/mongodb/read/aggregate.ts | Removed extra options from the aggregate call, streamlining the API usage during index checks. |
.github/workflows/code_health.yaml | Updated workflow conditions to run tests on push events, preventing missed failures. |
Comments suppressed due to low confidence (2)
src/tools/mongodb/read/aggregate.ts:32
- Confirm that the removal of the options parameters is intentional and that the default behavior of the aggregate function meets the index check requirements.
.aggregate(database, collection, pipeline)
.github/workflows/code_health.yaml:14
- Verify that the updated condition correctly distinguishes between push and pull request events so that tests are not inadvertently triggered in undesired scenarios.
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
@@ -70,6 +70,7 @@ export function setupMongoDBIntegrationTest(): MongoDBIntegrationTest { | |||
tmpDir: dbsDir, | |||
logDir: path.join(tmpDir, "mongodb-runner", "logs"), | |||
topology: "standalone", | |||
version: "8.0.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] Consider adding a comment to clarify why MongoDB version 8.0.10 is hard-coded here or parameterize it for future flexibility.
version: "8.0.10", | |
version: DEFAULT_MONGODB_VERSION, |
Copilot uses AI. Check for mistakes.
src/tools/mongodb/read/aggregate.ts
Outdated
@@ -29,7 +29,7 @@ export class AggregateTool extends MongoDBToolBase { | |||
if (this.config.indexCheck) { | |||
await checkIndexUsage(provider, database, collection, "aggregate", async () => { | |||
return provider | |||
.aggregate(database, collection, pipeline, {}, { writeConcern: undefined }) | |||
.aggregate(database, collection, pipeline) |
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.
main fix
Proposed changes
Tests are currently failing on main, we never noticed because we are not running tests against merged commits only PRs
Checklist