Convert all tests in integration to use the testify suite package#973
Convert all tests in integration to use the testify suite package#973
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.)
| func(t *testing.T) { | ||
| testDumpAndRestoreConfigDBIncludesAllCollections(t) | ||
| func() { | ||
| testDumpAndRestoreConfigDBIncludesAllCollections(s.T()) |
There was a problem hiding this comment.
Anywhere in here we're passing around s.T() these should probably just be methods on the suite instead.
There was a problem hiding this comment.
This should be fixed now.
| assert.Equal( | ||
| t, | ||
| s.T(), |
There was a problem hiding this comment.
This should be s.Assert().Equal(...) (I suspect there are more of these hiding around.)
| err = testDB.Drop(ctx) | ||
| if err != nil { | ||
| t.Fatalf("Failed to drop test database: %v", err) | ||
| s.T().Fatalf("Failed to drop test database: %v", err) |
There was a problem hiding this comment.
This can just be s.Require.NoError(err).
integration/importexport/csv_test.go
Outdated
| assert.EqualValues(t, 0, n, "c=3 should not have been exported (not in fieldFile)") | ||
| n, err := dest.CountDocuments(s.T().Context(), bson.D{{"a", 1}}) | ||
| s.Require().NoError(err) | ||
| s.EqualValues(3, n, "3 documents should have a=1") |
There was a problem hiding this comment.
I don't know if the tools officially have the same style guide mongosync does, but
- these should be
s.Assert().EqualValues(...), and - we should add the testifylint linter in this repo to catch this stuff.
There was a problem hiding this comment.
There's really no style guide for the tools. We should probably copy the one from mongosync. I will make a PR.
There was a problem hiding this comment.
Actually, I take it back. In the Mongosync coding standards docs, we already say this applied to the DB Tools.
323143c to
e8844d7
Compare
|
I added an |

No description provided.