func assertContainsFields(a *testutil.Accumulator, t *testing.T, measurement string, fieldSet []map[string]interface{}) { a.Lock() defer a.Unlock() numEquals := 0 for _, p := range a.Metrics { if p.Measurement == measurement { for _, fields := range fieldSet { if reflect.DeepEqual(fields, p.Fields) { numEquals++ } } } } if numEquals != len(fieldSet) { assert.Fail(t, fmt.Sprintf("only %d of %d are equal", numEquals, len(fieldSet))) } }