Skip to content

Commit

Permalink
Fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sayden committed May 8, 2022
1 parent ac2f7da commit 503b68f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions metricbeat/module/mongodb/dbstats/dbstats_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,33 @@ func TestFetch(t *testing.T) {
db := metricsetFields["db"].(string)
assert.NotEqual(t, db, "")

collections := metricsetFields["collections"].(int64)
collections := metricsetFields["collections"].(int32)
assert.True(t, collections > 0)

objects := metricsetFields["objects"].(int64)
objects := metricsetFields["objects"].(int32)
assert.True(t, objects > 0)

avgObjSize, err := metricsetFields.GetValue("avg_obj_size.bytes")
assert.NoError(t, err)
assert.True(t, avgObjSize.(int64) > 0)
assert.True(t, avgObjSize.(float64) > 0)

dataSize, err := metricsetFields.GetValue("data_size.bytes")
assert.NoError(t, err)
assert.True(t, dataSize.(int64) > 0)
assert.True(t, dataSize.(float64) > 0)

storageSize, err := metricsetFields.GetValue("storage_size.bytes")
assert.NoError(t, err)
assert.True(t, storageSize.(int64) > 0)
assert.True(t, storageSize.(float64) > 0)

numExtents := metricsetFields["num_extents"].(int64)
numExtents := metricsetFields["num_extents"].(int32)
assert.True(t, numExtents >= 0)

indexes := metricsetFields["indexes"].(int64)
indexes := metricsetFields["indexes"].(int32)
assert.True(t, indexes >= 0)

indexSize, err := metricsetFields.GetValue("index_size.bytes")
assert.NoError(t, err)
assert.True(t, indexSize.(int64) > 0)
assert.True(t, indexSize.(float64) > 0)
}
}

Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/mongodb/status/status_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ func TestFetch(t *testing.T) {

// Check event fields
current, _ := event.GetValue("mongodb.status.connections.current")
assert.True(t, current.(int64) >= 0)
assert.True(t, current.(int32) >= 0)

available, _ := event.GetValue("mongodb.status.connections.available")
assert.True(t, available.(int64) > 0)
assert.True(t, available.(int32) > 0)

pageFaults, _ := event.GetValue("mongodb.status.extra_info.page_faults")
assert.True(t, pageFaults.(int64) >= 0)
assert.True(t, pageFaults.(int32) >= 0)
}

func TestData(t *testing.T) {
Expand Down

0 comments on commit 503b68f

Please sign in to comment.