diff --git a/exporter/elasticsearchexporter/logs_exporter_test.go b/exporter/elasticsearchexporter/logs_exporter_test.go index fad60b7a28d5..60bc7d6ba719 100644 --- a/exporter/elasticsearchexporter/logs_exporter_test.go +++ b/exporter/elasticsearchexporter/logs_exporter_test.go @@ -173,9 +173,15 @@ func TestExporter_PushEvent(t *testing.T) { server := newESTestServer(t, func(docs []itemRequest) ([]itemResponse, error) { rec.Record(docs) - expected := `{"attrKey1":"abc","attrKey2":"def","application":"myapp","service":{"name":"myservice"},"error":{"stacktrace":"no no no no"},"agent":{"name":"otlp"},"@timestamp":"1970-01-01T00:00:00.000000000Z","message":"hello world"}` - actual := string(docs[0].Document) - assert.Equal(t, expected, actual) + var expectedDoc, actualDoc map[string]any + expected := []byte(`{"attrKey1":"abc","attrKey2":"def","application":"myapp","service":{"name":"myservice"},"error":{"stacktrace":"no no no no"},"agent":{"name":"otlp"},"@timestamp":"1970-01-01T00:00:00.000000000Z","message":"hello world"}`) + err := json.Unmarshal(expected, &expectedDoc) + require.NoError(t, err) + + actual := docs[0].Document + err = json.Unmarshal(actual, &actualDoc) + require.NoError(t, err) + assert.Equal(t, expectedDoc, actualDoc) return itemsAllOK(docs) })