-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
jdbc-connectors: remove LEGACY state #33201
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
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,
|
# Conflicts: # airbyte-integrations/connectors/source-postgres/src/test/java/io/airbyte/integrations/source/postgres/CdcPostgresSourceTest.java # airbyte-integrations/connectors/source-postgres/src/test/java/io/airbyte/integrations/source/postgres/PostgresSourceTest.java
Coverage report for 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.
Sorry for taking a while to review this. There's a lot here! Kudos.
- The CDK changes LGTM. Note that there are comments I left in non-CDK files about things which could be in the CDK.
- This PR does other things besides removing LEGACY: it bumps the CDK dependency on all java connectors and tries to get the connectors tests to pass, which in some cases hasn't been done in more than a year.
- Given that, I suggest you limit this PR to CDK changes only and open separate PRs for each connector. We can then deal with each one independently and on our own schedule, in a way that doesn't involve disabling tests unless we have a good reason to (and then state that reason in the annotation). Those PRs will also be easier to review. I'll be happy to help you do this.
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
@Disabled |
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 deliberate? I don't understand why this test is disabled. This comment applies elsewhere in this PR as well.
|
||
} | ||
|
||
} |
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 works. Though, the point of these objects is that many instances of these can share one container. It might be worth adding a // TODO: implement shared container
comment or something.
@@ -57,6 +58,8 @@ public static void setup() { | |||
} | |||
|
|||
@Test | |||
@Disabled("Flaky on CI, See run https://github.com/airbytehq/airbyte/actions/runs/7126781640/job/19405426141?pr=33201 " + | |||
"org.opentest4j.AssertionFailedError: Expected size between 964 and 985, but actual size was 991 ==> expected: <true> but was: <false>") |
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.
Urgh, this again. These tests should be rewritten to use deterministic inputs.
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 out of scope for this PR, naturally.
|
||
@Override | ||
public String getDriverClassName() { | ||
return SNOWFLAKE.getDriverClassName(); |
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.
Why SNOWFLAKE
?
|
||
import org.testcontainers.containers.JdbcDatabaseContainer; | ||
|
||
public class NonContainer extends JdbcDatabaseContainer<NonContainer> { |
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.
Commentary required. Do I understand correctly that this is a shim for when a test relies on a shared instance somewhere rather than a testcontainer?
public String getDriverClass() { | ||
return TiDBSource.DRIVER_CLASS; | ||
public JsonNode config() { | ||
return Jsons.clone(testdb.configBuilder().build()); |
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.
Cloning the return value of build
is not required, it's a fresh JsonNode
. This comment applies elsewhere in this PR as well.
import java.util.stream.Stream; | ||
import org.jooq.SQLDialect; | ||
|
||
public class TeradataTestDatabase extends TestDatabase<NonContainer, TeradataTestDatabase, TeradataTestDatabase.TeradataDbConfigBuilder> { |
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.
Consider defining a NonContainerTestDatabase
class in the CDK which extends TestDatabase<NonContainer, NonContainerTestDatabase, NonContainerTestDatabase.NonContainerTestDatabaseConfigBuilder>
and use that here and in other connectors which don't rely on testcontainers. Inject the username, password, sql dialect etc. as constructor args.
public Db2TestDatabase initialized() { | ||
if (!containerStarted) { | ||
container.start(); | ||
containerStarted = true; |
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.
The .start()
method is idempotent so containerStarted
isn't needed. Plus, it's static for some reason.
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.
@postamar The start
method is called from createTestDatabase
within setup
which is executed before each unit test, I wanted to use the same connector for all the unit tests and not have docker container start and stop again. In order to do that I had to introduce containerStarted
and make it static
@BeforeEach
public void setup() throws Exception {
customSetup();
testdb = createTestDatabase();
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 understand. The place to put the .start()
call is in the @BeforeAll
static method.
- config_path: "secrets/sat-config.json" | ||
# discovery: | ||
# tests: | ||
# - config_path: "secrets/sat-config.json" |
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 deliberate?
@postamar The aim of the work is to stop emitting LEGACY state and in order to do that I need to release these uncertified connectors so that we are sure that no place is emitting LEGACY state with the latest piece of code. I would like to go ahead with the PR as it is. Remember am not changing anything in the certified connectors and they stay the same, the aim of this work is the uncertified connectors.
|
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 understand your aim. I strongly believe that it's a bad idea to merge a PR like this one because the risk of breaking the build for a certified connector is too high. For a start, right now, source-mysql doesn't even compile. At least make separate PRs for certified connectors, please. It's really not that much extra work and being sure that you're not creating more work for others is worth it.
I don't care much about the uncertified connectors but they should at least compile. This can be ascertained by the "Repository Health Check". I'm OK with you keeping those in this PR if you insist, since those changes are going to be merged bypassing the branch protections in any case.
public Db2TestDatabase initialized() { | ||
if (!containerStarted) { | ||
container.start(); | ||
containerStarted = true; |
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 understand. The place to put the .start()
call is in the @BeforeAll
static method.
Issue : #33290