Skip to content

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

Merged
merged 3 commits into from
Jun 30, 2025
Merged

fix: index tests #331

merged 3 commits into from
Jun 30, 2025

Conversation

fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Jun 30, 2025

Proposed changes

Tests are currently failing on main, we never noticed because we are not running tests against merged commits only PRs

Checklist

@fmenezes fmenezes marked this pull request as ready for review June 30, 2025 16:48
@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 16:48
@fmenezes fmenezes requested a review from a team as a code owner June 30, 2025 16:48
Copy link
Contributor

@Copilot Copilot AI left a 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",
Copy link
Preview

Copilot AI Jun 30, 2025

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.

Suggested change
version: "8.0.10",
version: DEFAULT_MONGODB_VERSION,

Copilot uses AI. Check for mistakes.

@@ -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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main fix

@fmenezes fmenezes enabled auto-merge (squash) June 30, 2025 16:50
@fmenezes fmenezes merged commit 53ea41c into main Jun 30, 2025
16 of 17 checks passed
@fmenezes fmenezes deleted the fix_index_tests branch June 30, 2025 17:11
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