-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
connectors-ci: fix postgres integration testing #25942
Conversation
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
/test connector=connectors/source-postgres
Build PassedTest summary info:
|
6faf3f4
to
56e6eee
Compare
…e into augustin/debug-postgres
🎉Achieved both successful /test above and successful Dagger pipeline run here. Some CDC testing about WAL and Data type look flaky locally / on Dagger pipeline. I'm going to re-run the Dagger pipeline a couple of time for sanity. |
Confirmed the flakyness of |
f2bddce
to
c03db6b
Compare
Consequents pipeline runs to check flakyness after modifying |
/test connector=connectors/source-postgres |
/test connector=connectors/source-postgres |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to punt on this review... I don't really know enough about what's going on in Java to be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment about a comment.
Outside of that I have no objections.
.with_exec(["mkdir", "/airbyte"]) | ||
.with_mounted_directory("/airbyte", context.get_repo_dir(".", include=include)) | ||
.with_mounted_cache("/airbyte/.gradle", airbyte_gradle_cache, sharing=CacheSharingMode.LOCKED) | ||
.with_workdir("/airbyte") | ||
) | ||
if context.is_ci: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alafanechere Can we leave a comment around this that explains
- What we are doing
- Why
- When we should remove it and whos responsible
return System.getProperty("os.name").toLowerCase().startsWith("mac") | ||
? getIpAddress(container) | ||
: container.getHost(); | ||
return getIpAddress(container); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to break the clickhouse integration tests on Mac I think.
The original change was #14701 back in July last year
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source-clickhouse that is
config = Jsons.jsonNode(ImmutableMap.builder() | ||
.put("host", containerInnerAddress.left) | ||
.put("port", containerInnerAddress.right) | ||
.put("host", HostPortResolver.resolveHost(container)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to return the inner address and port of a container? This was the reason tests were originally failing when run on Mac.
Can you validate that running integration test on your Mac is still passing.
For example:
./gradlew --info :airbyte-integrations:connectors:source-postgres:integrationTestJava --tests "io.airbyte.integrations.io.airbyte.integration_tests.sources.PostgresSourceSSLCaCertificateAcceptanceTest"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
I'm just making sure as I don't know dagger 😅
@@ -23,7 +23,7 @@ public class CdcInitialSnapshotPostgresSourceDatatypeTest extends AbstractPostgr | |||
private static final String SCHEMA_NAME = "test"; | |||
private static final String SLOT_NAME_BASE = "debezium_slot"; | |||
private static final String PUBLICATION = "publication"; | |||
private static final int INITIAL_WAITING_SECONDS = 5; | |||
private static final int INITIAL_WAITING_SECONDS = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the difference on dagger expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I faced flaky results on my local machine too and increasing the waiting time mitigate these problems on both local and dagger. I found a PR from Sergio on another connector that did it for the same reasons.
/test connector=connectors/source-clickhouse
Build PassedTest summary info:
|
@alafanechere I see source-clickhouse failing locally on my Mac with and without your change (I wonder if this is happening to all or just on my setup). |
🙏 |
What
Closes #25381
This PR is an attempt to make source-postgres integration java test pass in the Dagger pipeline context, and still making them work for original /test run or locally.
Original problems:
How
Fixing networking issues
There were inconsistencies in the way test set up the source-postgres configuration to connect to the test database.
The Java test need to access to test databases to seed it with test data. In this context the java test should resolve the database host/port targetting the docker host and the exposed ports.
The source-postgres need to connect to test databases to READ. In this context, to resolve the database host/port the internal container ip/exposed ports must be used.
In practice:
To fill the source-postgres config we get the container internal ip address/exposed port by using
HostPortResolver
utility class:To seed the test database we use the host/exposed port by using the
.getHost()
/.getFirstMappedPort()
on the container object:Fixing CDC test flakyness
Increasing the value of
INITIAL_WAITING_SECONDS
to30
seconds in the connector config made tests more stable. I observed the flakyness locally and in dagger pipelines.Improving Gradle performance in Dagger Pipeline
I introduced the use of the Gradle S3 cache in Dagger pipeline to benefit from cross build caching in the CI.
Even if caching is enabled by default in our main
gradle.properties
file the cache is not used for local run according tosettings.gradle
. To enable the use of the gradle remote cache I added the required env var to the gradle container.🚨 User Impact 🚨
According to my manual tests these changes make
source-postgres:integrationTestJava
pass locally, in dagger pipelines and we /test.Please note that these inconsistency in how we connect to test databases are also present on other java connectors. I focused on source-posgres because it's GA. I might proceed in changing other connectors if this PR is 👍 and I spot other /test vs Dagger pipeline inconsistencies.