Skip to content

TOOLS-4263 Convert CSV and TSV round trip tests to Go - #1131

Draft
autarch wants to merge 1 commit into
08-11-tools-4263_convert_mongodump_auth_profile_dump_test_to_gofrom
08-11-tools-4263_convert_csv_and_tsv_round_trip_tests_to_go
Draft

TOOLS-4263 Convert CSV and TSV round trip tests to Go#1131
autarch wants to merge 1 commit into
08-11-tools-4263_convert_mongodump_auth_profile_dump_test_to_gofrom
08-11-tools-4263_convert_csv_and_tsv_round_trip_tests_to_go

Conversation

@autarch

@autarch autarch commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Starts phase 4 of the JS test migration, moving the delimited-text export and
import tests into integration/exportimport.

  • test/legacy42/jstests/tool/csv1.js -> integration/exportimport/csv_test.go - a CSV round trip of values holding commas and embedded double quotes, and of a field name holding a space
  • test/legacy42/jstests/tool/csvimport1.js -> integration/exportimport/csv_test.go - CSV import of newlines inside quoted cells, doubled quotes, backslashes, empty cells, and padding around quoted cells
  • test/legacy42/jstests/tool/tsv1.js -> integration/exportimport/csv_test.go - TSV import with --fields and with --headerline
  • test/legacy42/jstests/tool/csvexport1.js -> integration/exportimport/csv_test.go - CSV export formatting of ObjectId, MinKey, BinData, date, Timestamp, regex and JavaScript values

The two data files under test/legacy42/jstests/tool/data go too. Only these
tests read them, so their contents are now consts in the Go test, byte for byte
including the whitespace around the quoted cells that the parser has to strip.

Each import test asserts the whole resulting document rather than a count, and
runs twice: once with --fields, where the header row has to import as ordinary
data, and once with --headerline, where it has to be consumed. The export test
asserts the exact text of every exported cell, which the JS could not do because
it only compared documents after importing the export back. It then imports that
text back as well, so both halves of what the JS covered are still covered.

autarch commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

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 force-pushed the 08-11-tools-4263_convert_csv_and_tsv_round_trip_tests_to_go branch from 65f84e6 to 8ec5e61 Compare August 25, 2026 15:30
@autarch
autarch force-pushed the 08-11-tools-4263_convert_mongodump_auth_profile_dump_test_to_go branch from 8ce9918 to 82d5ce4 Compare August 25, 2026 15:30
Starts phase 4 of the JS test migration, moving the delimited-text export and
import tests into integration/exportimport.

* test/legacy42/jstests/tool/csv1.js -> integration/exportimport/csv_test.go - a CSV round trip of values holding commas and embedded double quotes, and of a field name holding a space
* test/legacy42/jstests/tool/csvimport1.js -> integration/exportimport/csv_test.go - CSV import of newlines inside quoted cells, doubled quotes, backslashes, empty cells, and padding around quoted cells
* test/legacy42/jstests/tool/tsv1.js -> integration/exportimport/csv_test.go - TSV import with --fields and with --headerline
* test/legacy42/jstests/tool/csvexport1.js -> integration/exportimport/csv_test.go - CSV export formatting of ObjectId, MinKey, BinData, date, Timestamp, regex and JavaScript values

The two data files under test/legacy42/jstests/tool/data go too. Only these
tests read them, so their contents are now consts in the Go test, byte for byte
including the whitespace around the quoted cells that the parser has to strip.

Each import test asserts the whole resulting document rather than a count, and
runs twice: once with --fields, where the header row has to import as ordinary
data, and once with --headerline, where it has to be consumed. The export test
asserts the exact text of every exported cell, which the JS could not do because
it only compared documents after importing the export back. It then imports that
text back as well, so both halves of what the JS covered are still covered.
@autarch
autarch force-pushed the 08-11-tools-4263_convert_mongodump_auth_profile_dump_test_to_go branch from 82d5ce4 to e668a2a Compare August 25, 2026 20:18
@autarch
autarch force-pushed the 08-11-tools-4263_convert_csv_and_tsv_round_trip_tests_to_go branch from 8ec5e61 to 5260f99 Compare August 25, 2026 20:18
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