Conversation
6c44f53 to
efb6f41
Compare
86aad88 to
721a4f6
Compare
721a4f6 to
5f9bf57
Compare
5f9bf57 to
13ba381
Compare
efb6f41 to
53ae805
Compare
cc948a7 to
323143c
Compare
mmcclimon
left a comment
There was a problem hiding this comment.
I didn't read everything closely here because I noticed enough on the skim that I think we should take another run at this one. Probably you could catch nearly everything by searching for s.T() and removing nearly all of them. (It's probably totally reasonable to make s.Context() which is just a wrapper for s.T().Context(), for example.)
323143c to
e8844d7
Compare
|
I added an |
e8844d7 to
9842ff5
Compare
9842ff5 to
4af151d
Compare
4f5e086 to
4c3fdbb
Compare
4af151d to
b907c8a
Compare
b907c8a to
fb5a1b5
Compare
4c3fdbb to
5d5ee94
Compare
fb5a1b5 to
098c623
Compare
mmcclimon
left a comment
There was a problem hiding this comment.
Ok. These tests are all still sort of weird, but I guess they're getting less weird over time, which is the goal.
| "github.com/mongodb/mongo-tools/common/testtype" | ||
| "github.com/mongodb/mongo-tools/common/testutil" | ||
| "github.com/mongodb/mongo-tools/common/wcwrapper" | ||
| integrationSuite "github.com/mongodb/mongo-tools/integration/suite" |
There was a problem hiding this comment.
Should we name this package something that's not suite so that we don't have to alias it like this?
There was a problem hiding this comment.
Renamed to sharedsuite.
| sessionProvider, _, err := testutil.GetBareSessionProvider() | ||
| s.Require().NoError(err, "should create session provider") | ||
| client, err := sessionProvider.GetSession() | ||
| s.Require().NoError(err, "should get session") |
There was a problem hiding this comment.
This should just use s.Client().
| } | ||
|
|
||
| func (s *ImportExportSuite) recreateWithValidator(coll *mongo.Collection, validator any) { | ||
| s.Require().NoError(coll.Database().Drop(context.Background())) |
There was a problem hiding this comment.
| s.Require().NoError(coll.Database().Drop(context.Background())) | |
| s.Require().NoError(coll.Database().Drop(s.Context())) |
| s.Require().NoError(coll.Database().Drop(context.Background())) | ||
| s.Require().NoError( | ||
| coll.Database().CreateCollection( | ||
| context.Background(), coll.Name(), mopt.CreateCollection().SetValidator(validator), |
There was a problem hiding this comment.
| context.Background(), coll.Name(), mopt.CreateCollection().SetValidator(validator), | |
| s.Context(), coll.Name(), mopt.CreateCollection().SetValidator(validator), |
|
|
||
| func runBSONMongodumpForCollection( | ||
| t *testing.T, | ||
| func (s *DumpRestoreSuite) runBSONMongodumpForCollection( |
There was a problem hiding this comment.
It's a little weird that this package defines all these helpers in this main test file, while the exportimport package defines them in the suite helpers file.
There was a problem hiding this comment.
I moved the helpers.
| s.Run("If --dumpUsersAndRoles was not used with the target", func() { | ||
| s.Run("Restoring from db directory should not be allowed", func() { |
There was a problem hiding this comment.
(These subtest names are still extremely convey-coded.)
There was a problem hiding this comment.
I modified several other subtest names.
| s.T().Cleanup(func() { | ||
| _ = client.Database(dbName).Drop(context.Background()) | ||
| }) |
There was a problem hiding this comment.
This is super weird, but probably (I hope) this goes away in the next PR to run a BeforeTest cleanup thing.
098c623 to
2331e2c
Compare
2331e2c to
30988fd
Compare

As part of this, I created a new
integration/suitepackage which contains code that is shared between the export/import and dump/restore tests. The helper funcs for the export/import tests are now methods on theImportExportSuite.