Skip to content

Conversation

addaleax
Copy link
Collaborator

@addaleax addaleax commented Oct 3, 2025

These have been broken since 684002c, silently failing in CI. This commit re-enables failing on a broken test and fixes the tests that have started to fail since then.

These have been broken since 684002c, silently failing in CI.
This commit re-enables failing on a broken test and fixes the tests
that have started to fail since then.
@addaleax addaleax requested a review from a team as a code owner October 3, 2025 13:26
@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 13:26
@addaleax addaleax changed the title fix(java-shell): make tests run and pass again fix(java-shell): make tests run and pass again MONGOSH-2711 Oct 3, 2025
Copy link

@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 fixes broken Java shell tests that have been silently failing since commit 684002c. The changes re-enable test failure detection and fix compatibility issues that have accumulated over time.

  • Re-enables proper test failure detection by checking exit codes
  • Fixes BSON library compatibility issues by allowing explicit BSON library injection
  • Updates expected test outputs to match current behavior

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/shell-api/src/shell-instance-state.ts Adds BSON library parameter to constructor for explicit library injection
packages/shell-api/src/collection.ts Fixes projection/fields option handling logic
packages/java-shell/src/test/resources/literal/long.expected.txt Updates expected double result value
packages/java-shell/src/test/resources/db/help.expected.txt Updates expected help output from "use" to "log"
packages/java-shell/src/test/resources/collection/aggregateWithNegativeBatchSize.expected.4.txt Adds expected error message for negative batch size
packages/java-shell/src/test/js/run-tests.ts Adds exit code checking to fail tests properly
packages/java-shell/src/main/js/all.js Creates custom ShellInstanceState class with explicit BSON library

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -0,0 +1,3 @@
LongResult: 2147483649
DoubleResult: 1281104301025214500
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

^ Apparently it depends on some external factor (Java version?) whether evaluating 1281104301025214467 as a JS string results in 1281104301025214460 or 1281104301025214500 when stringified again. Since the latter seems to be the JS standard behavior, I think it's okay to add this as an alternative here

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.

1 participant