Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests after new timereceived field #238

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/pipeline/ingest/ingest_kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ func Test_NewIngestKafka2(t *testing.T) {
require.Equal(t, defaultBatchReadTimeout, ingestKafka.kafkaParams.BatchReadTimeout)
}

func removeTimestamp(receivedEntries []config.GenericMap) {
for _, entry := range receivedEntries {
delete(entry, "TimeReceived")
}
}

func Test_IngestKafka(t *testing.T) {
newIngest := initNewIngestKafka(t, testConfig1)
ingestKafka := newIngest.(*ingestKafka)
Expand All @@ -124,6 +130,10 @@ func Test_IngestKafka(t *testing.T) {
// wait for the data to have been processed
receivedEntries := <-ingestOutput

// we remove timestamp for test stability
// Timereceived field is tested in the decodeJson tests
removeTimestamp(receivedEntries)

require.Equal(t, 3, len(receivedEntries))
require.Equal(t, test.DeserializeJSONToMap(t, record1), receivedEntries[0])
require.Equal(t, test.DeserializeJSONToMap(t, record2), receivedEntries[1])
Expand Down Expand Up @@ -175,6 +185,10 @@ func Test_KafkaListener(t *testing.T) {
// wait for the data to have been processed
receivedEntries := <-ingestOutput

// we remove timestamp for test stability
// Timereceived field is tested in the decodeJson tests
removeTimestamp(receivedEntries)

require.Equal(t, 1, len(receivedEntries))
require.Equal(t, test.DeserializeJSONToMap(t, string(fakeRecord)), receivedEntries[0])
}