Skip to content

Commit

Permalink
Fix fluky test (#757)
Browse files Browse the repository at this point in the history
We run a lot of tests in parallel, so the number of collections is in the range between 1 (this test) and many, where "many" is 100 for now.
Uptime can also be as small as 0 seconds on a fast machine but can also be large if the environment wasn't restarted for a long time.
  • Loading branch information
AlekSi authored Jun 21, 2022
1 parent cf873e8 commit b0a2b4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions integration/commands_administration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,18 +781,18 @@ func TestCommandsAdministrationServerStatus(t *testing.T) {
assert.Regexp(t, `^5\.0\.`, must.NotFail(doc.Get("version")))
assert.NotEmpty(t, must.NotFail(doc.Get("process")))

assert.InDelta(t, float64(1), must.NotFail(doc.Get("pid")), 5_000_000)
assert.InDelta(t, float64(0), must.NotFail(doc.Get("uptime")), 600)
assert.InDelta(t, float64(0), must.NotFail(doc.Get("uptimeMillis")), 600_000)
assert.InDelta(t, float64(0), must.NotFail(doc.Get("uptimeEstimate")), 6000)
assert.GreaterOrEqual(t, must.NotFail(doc.Get("pid")), int64(1))
assert.GreaterOrEqual(t, must.NotFail(doc.Get("uptime")), float64(0))
assert.GreaterOrEqual(t, must.NotFail(doc.Get("uptimeMillis")), int64(0))
assert.GreaterOrEqual(t, must.NotFail(doc.Get("uptimeEstimate")), int64(0))

expectedLocalTime := ConvertDocument(t, bson.D{{"localTime", primitive.NewDateTimeFromTime(time.Now())}})
testutil.CompareAndSetByPathTime(t, expectedLocalTime, doc, time.Duration(2*time.Second), types.NewPathFromString("localTime"))

catalogStats, ok := must.NotFail(doc.Get("catalogStats")).(*types.Document)
assert.True(t, ok)

assert.InDelta(t, float64(1), must.NotFail(catalogStats.Get("collections")), 50)
assert.InDelta(t, float64(51), must.NotFail(catalogStats.Get("collections")), 50)
assert.InDelta(t, float64(3), must.NotFail(catalogStats.Get("internalCollections")), 3)

assert.Equal(t, int32(0), must.NotFail(catalogStats.Get("capped")))
Expand Down

0 comments on commit b0a2b4e

Please sign in to comment.