acc := &testutil.Accumulator{} acc.AddFields("cpu_load", map[string]interface{}{"value": 0.5}) assert.True(t, acc.HasPoint("cpu_load", map[string]string{}, map[string]interface{}{"value": 0.5}))
acc := &testutil.Accumulator{} acc.AddError(fmt.Errorf("disk is full")) assert.Len(t, acc.Errors, 1)In this example, we add an error to the accumulator using the `AddError` function. We then use the `Len` function to check the number of errors stored in the accumulator. Overall, the `testutil` package with its `Accumulator` type provides useful utilities for testing Telegraf plugins and validating their results.