import ( "testing" "github.com/influxdata/telegraf/testutil" ) func TestMyPlugin(t *testing.T) { acc := testutil.Accumulator{} // Simulate receiving a metric from my plugin acc.AddFields("my_metric", map[string]interface{}{ "field1": 5, "field2": "test", }, nil) // Check if the metric was accumulated correctly acc.AssertContainsFields(t, "my_metric", map[string]interface{}{ "field1": 5, "field2": "test", }) }In this example, we create an instance of the "Accumulator" and simulate receiving a metric from a hypothetical plugin. We then use the "AssertContainsFields" function to check if the accumulator contains the expected fields for the "my_metric" metric. If any fields are missing or the values are different, the assertion will fail and the test will report an error.