Skip to content

TOOLS-4148 Convert test/qa-tests/jstests/import/mongoimport mode.js to Go#960

Open
autarch wants to merge 1 commit into03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_gofrom
03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests
Open

TOOLS-4148 Convert test/qa-tests/jstests/import/mongoimport mode.js to Go#960
autarch wants to merge 1 commit into03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_gofrom
03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests

Conversation

@autarch
Copy link
Collaborator

@autarch autarch commented Mar 26, 2026

Adds TestImportModes covering all --mode / --upsertFields combinations
from jstests/import/mode.js.

Notable implementation details:

  • Table-driven with importModeCase struct; wantErrContains checks
    specific error substrings via require.ErrorContains rather than just
    require.Error
  • runImportOpts helper returns errors from New() (unlike
    importWithIngestOpts which uses require.NoError), enabling error-path
    test cases for invalid option combinations
  • writeJSONLinesFile marshals []map[string]any to newline-separated JSON
    instead of hard-coding string literals
  • map[string]any decode results must be reset to map[string]any{} between
    FindOne/Decode calls; stale keys from a previous decode persist
    otherwise (bug found via test failure)

Copy link
Collaborator Author

autarch commented Mar 26, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@autarch autarch changed the title TOOLS-4148 Convert mongoimport mode.js to Go integration tests TOOLS-4148 Convert test/qa-tests/jstests/import/mongoimport mode.js to Go Mar 26, 2026
@autarch autarch force-pushed the 03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests branch 2 times, most recently from e7bccdc to 71cdaf9 Compare March 26, 2026 17:23
@autarch autarch force-pushed the 03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_go branch from 6fa9170 to 4aeb078 Compare March 26, 2026 17:23
@autarch autarch force-pushed the 03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests branch from 71cdaf9 to 14528f8 Compare March 26, 2026 21:53
@autarch autarch force-pushed the 03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_go branch from 4aeb078 to 14b8dcc Compare March 26, 2026 21:53
@autarch autarch marked this pull request as ready for review March 26, 2026 21:56
@autarch autarch requested a review from a team as a code owner March 26, 2026 21:56
@autarch autarch requested review from mmcclimon and removed request for a team March 26, 2026 21:56
@autarch autarch force-pushed the 03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_go branch from 14b8dcc to fdfe9f4 Compare March 26, 2026 22:02
@autarch autarch force-pushed the 03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests branch from 14528f8 to 22fc798 Compare March 26, 2026 22:02
Adds TestImportModes covering all --mode / --upsertFields combinations
from jstests/import/mode.js.

Notable implementation details:
- Table-driven with importModeCase struct; wantErrContains checks
  specific error substrings via require.ErrorContains rather than just
  require.Error
- runImportOpts helper returns errors from New() (unlike
  importWithIngestOpts which uses require.NoError), enabling error-path
  test cases for invalid option combinations
- writeJSONLinesFile marshals []map[string]any to newline-separated JSON
  instead of hard-coding string literals
- map[string]any decode results must be reset to map[string]any{} between
  FindOne/Decode calls; stale keys from a previous decode persist
  otherwise (bug found via test failure)
@autarch autarch force-pushed the 03-25-tools-4148_convert_mongoimport_mode.js_to_go_integration_tests branch from 22fc798 to c8a35cb Compare March 26, 2026 22:03
@autarch autarch force-pushed the 03-24-convert_test/qa-tests/jstests/import/import_document_validation.js_to_go branch from fdfe9f4 to 66c6cd4 Compare March 26, 2026 22:03
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