From da6a299a2266a24b47a1fb96ad3abb54a833018a Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 10 Apr 2018 17:24:40 -0700 Subject: [PATCH] Fix host ordering in mongodb unit tests --- plugins/inputs/mongodb/mongodb_data_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/mongodb/mongodb_data_test.go b/plugins/inputs/mongodb/mongodb_data_test.go index 9a5793f71..21541dd95 100644 --- a/plugins/inputs/mongodb/mongodb_data_test.go +++ b/plugins/inputs/mongodb/mongodb_data_test.go @@ -1,6 +1,7 @@ package mongodb import ( + "sort" "testing" "time" @@ -152,7 +153,8 @@ func TestAddShardHostStats(t *testing.T) { assert.True(t, acc.HasTag("mongodb_shard_stats", "hostname")) hostsFound = append(hostsFound, host) } - + sort.Strings(hostsFound) + sort.Strings(expectedHosts) assert.Equal(t, hostsFound, expectedHosts) }