-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ElasticSearch, GCS, Keen, Kafka, Kinesis destinations : Enable DAT te…
…sts (#11971) * add Boolean, Number, DateTimeWithTZ compare methods * Improve value comparison * Compare inherit objects element by element * Move comparison methods to a new class not to overload the test class. Basic - old implementation which provides backward compatibility of this PR. Advanced - comparator required for destinations with enabled DAT tests. * format * Move common method to ComparatorUtils. + Review update * format * review * review * mark resolveIdentifier method as deprecated * enable DAT tests for destination-Elasticsearch, destination-gcs, destination-kafka, destination-keen, destination-kinesis * remove size objects validation. We iterate expected elements and compare it with actualObject elements. Expected might have empty elements and they are equal missing element in the actual Object. Also, actualObject might contain additional elements which is not an exception. * fix Csv actual data read. + use proper comparator for different file types * format
- Loading branch information
1 parent
3113ef4
commit 57d059f
Showing
9 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t-integration/java/io/airbyte/integrations/destination/gcs/GcsAvroTestDataComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.gcs; | ||
|
||
import io.airbyte.integrations.standardtest.destination.comparator.AdvancedTestDataComparator; | ||
import java.time.*; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class GcsAvroTestDataComparator extends AdvancedTestDataComparator { | ||
|
||
@Override | ||
protected boolean compareDateValues(String expectedValue, String actualValue) { | ||
var destinationDate = LocalDate.ofEpochDay(Long.parseLong(actualValue)); | ||
var expectedDate = LocalDate.parse(expectedValue, DateTimeFormatter.ofPattern(AIRBYTE_DATE_FORMAT)); | ||
return expectedDate.equals(destinationDate); | ||
} | ||
|
||
private Instant getInstantFromEpoch(String epochValue) { | ||
return Instant.ofEpochMilli(Long.parseLong(epochValue.replaceAll("000$", ""))); | ||
} | ||
|
||
@Override | ||
protected ZonedDateTime parseDestinationDateWithTz(String destinationValue) { | ||
return ZonedDateTime.ofInstant(getInstantFromEpoch(destinationValue), ZoneOffset.UTC); | ||
} | ||
|
||
@Override | ||
protected boolean compareDateTimeValues(String airbyteMessageValue, String destinationValue) { | ||
var format = DateTimeFormatter.ofPattern(AIRBYTE_DATETIME_FORMAT); | ||
LocalDateTime dateTime = LocalDateTime.ofInstant(getInstantFromEpoch(destinationValue), ZoneOffset.UTC); | ||
return super.compareDateTimeValues(airbyteMessageValue, format.format(dateTime)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters