Skip to content

TOOLS-4148 Convert test/qa-tests/jstests/export/basic_data.js to Go#925

Merged
autarch merged 1 commit intomasterfrom
03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go
Mar 30, 2026
Merged

TOOLS-4148 Convert test/qa-tests/jstests/export/basic_data.js to Go#925
autarch merged 1 commit intomasterfrom
03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go

Conversation

@autarch
Copy link
Copy Markdown
Collaborator

@autarch autarch commented Mar 20, 2026

This PR adds a new TestRoundTripBasicData test to mongoimport/mongoimport_test.go. The test inserts 50 docs, exports them as JSON, and then imports them to test a basic round trip scenario.

Copy link
Copy Markdown
Collaborator Author

autarch commented Mar 20, 2026

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

@autarch autarch force-pushed the 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this branch from 6a8bc27 to ce94d63 Compare March 20, 2026 21:26
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from 97fa2e2 to a95e9d2 Compare March 20, 2026 21:26
@autarch autarch changed the base branch from 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this to graphite-base/925 March 23, 2026 15:07
@autarch autarch force-pushed the graphite-base/925 branch from ce94d63 to 93cafd5 Compare March 23, 2026 15:12
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from a95e9d2 to 10d6e5e Compare March 23, 2026 15:12
@autarch autarch changed the base branch from graphite-base/925 to 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this March 23, 2026 15:12
@autarch autarch force-pushed the 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this branch from 93cafd5 to d6504ac Compare March 23, 2026 15:30
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from 10d6e5e to 1e1b554 Compare March 23, 2026 15:30
@autarch autarch requested review from mmcclimon and removed request for nickweinberger March 27, 2026 18:19
@autarch autarch force-pushed the 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this branch from a0ef32f to b457216 Compare March 27, 2026 18:27
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from 65fd1be to 0714696 Compare March 27, 2026 18:27
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from 0714696 to cef05b8 Compare March 27, 2026 20:27
@autarch autarch force-pushed the 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this branch from b457216 to 9db3a63 Compare March 27, 2026 20:27
@autarch autarch changed the base branch from 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this to graphite-base/925 March 27, 2026 21:12
Copy link
Copy Markdown
Contributor

@mmcclimon mmcclimon left a comment

Choose a reason for hiding this comment

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

I also left this comment like 5 minutes ago on the DSC testing thing, but: I think it would be useful to have a conversation about where to put / how to do these round-trip tests. I recently added (at your prompting) an integration/importexport directory to put these kinds of tests, because I feel like it's sort of weird to put them in either mongoimport/ or mongoexport/.

Like this test is fine, and we can always move them later if we want, but it would also be nice if we didn't have to and could just rewrite them all once. The tests I wrote also used the testify suite, which I prefer to passing t around everywhere, and I'd imagined that the other e2e-style tests would do similar, and we probably don't want to rewrite them all twice (once to Go, once to suite-style). We don't have to use the suites, of course, but we do in mongosync and I would love to have one way to write tests instead of 7.

require.NoError(t, err)
assert.EqualValues(t, 50, count, "collection should have all 50 documents after round-trip")

for i := range int32(50) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your robot is obsessed with int32s, man.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think that's because the existing test code is constantly doing this already, and it's trying to match the existing style. Why does the existing code do this? I dunno 🤷

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was wondering if it was like, "well, numbers in JS are all floats, so we might not always be able to fit a 64-bit int" or something.

Copy link
Copy Markdown
Collaborator Author

autarch commented Mar 30, 2026

I actually was thinking of moving them after doing a bunch of these test conversions. At this point, I'd like to just merge these as-is and do some cleanup after. I also agree that moving to using a testify suite would be good. But I'd also like to defer that until after mergint his mega-stack.

@autarch autarch force-pushed the graphite-base/925 branch from 9db3a63 to 41037a4 Compare March 30, 2026 15:08
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from cef05b8 to 37051b2 Compare March 30, 2026 15:08
@autarch autarch changed the base branch from graphite-base/925 to 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this March 30, 2026 15:08
@autarch autarch requested a review from mmcclimon March 30, 2026 15:08
Copy link
Copy Markdown
Contributor

@mmcclimon mmcclimon left a comment

Choose a reason for hiding this comment

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

I actually was thinking of moving them after doing a bunch of these test conversions. At this point, I'd like to just merge these as-is and do some cleanup after. I also agree that moving to using a testify suite would be good. But I'd also like to defer that until after mergint his mega-stack.

Cool, sounds good to me; I just wanted to make sure we were vaguely aligned on the direction we want to shove on these.

Change LGTM, thanks!

Copy link
Copy Markdown
Collaborator Author

autarch commented Mar 30, 2026

I went through the entire stack and fixed all the many places it pointlessly used an int32.

@autarch autarch changed the base branch from 03-19-rewrite_all_the_bsondump_tests_in_go_and_delete_the_js_tests_for_this to graphite-base/925 March 30, 2026 15:27
@autarch autarch force-pushed the graphite-base/925 branch from 41037a4 to bbb8792 Compare March 30, 2026 15:28
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from 37051b2 to ab92ff8 Compare March 30, 2026 15:28
@graphite-app graphite-app bot changed the base branch from graphite-base/925 to master March 30, 2026 15:29
This PR adds a new  `TestRoundTripBasicData` test to `mongoimport/mongoimport_test.go`. The test inserts 50 docs, exports them as JSON, and then imports them to test a basic round trip scenario.
@autarch autarch force-pushed the 03-20-convert_test/qa-tests/jstests/export/basic_data.js_to_go branch from ab92ff8 to 6805d1c Compare March 30, 2026 15:29
Copy link
Copy Markdown
Collaborator Author

autarch commented Mar 30, 2026

Merge activity

  • Mar 30, 5:05 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 30, 5:06 PM UTC: @autarch merged this pull request with Graphite.

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