Skip to content

Conversation

@wombatu-kun
Copy link
Contributor

@wombatu-kun wombatu-kun commented Dec 28, 2024

I've found a lot of code duplicates in integration tests of module iceberg-kafka-connect-runtime. I propose to avoid such code duplication by making parent class IntegrationTestBase abstract and move all common logic (beforeEach, afterEach, creating kafka common config, running test, asserting snapshot is added) from IntegrationTest, IntegrationMultiTableTest and IntegrationDynamicTableTest to IntegrationTestBase.

// partitioned table
catalog().createTable(TABLE_IDENTIFIER1, TestEvent.TEST_SCHEMA, TestEvent.TEST_SPEC);
// unpartitioned table
// non-partitioned table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use "unpartitioned" throughout the Iceberg code, so please revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, didn't know that. reverted

public void baseAfter() {
context().stopConnector(connectorName());
deleteTopic(testTopic());
catalog().dropTable(TableIdentifier.of(TEST_DB, TEST_TABLE1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the drop table belongs in the subclass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with you, fixed

@bryanck
Copy link
Contributor

bryanck commented Jan 2, 2025

Thanks @wombatu-kun , it mostly looks good, I added a couple of comments.

@wombatu-kun wombatu-kun force-pushed the kafka-connect-runtime-integration-tests-refactoring branch from d82e94f to 1772bef Compare January 2, 2025 05:47
@wombatu-kun wombatu-kun requested a review from bryanck January 2, 2025 07:21

protected static final int TEST_TOPIC_PARTITIONS = 2;
protected static final String TEST_DB = "test";
protected static final String TEST_TABLE1 = "foobar1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we should keep the table name constants in the subclasses as well.

@wombatu-kun wombatu-kun force-pushed the kafka-connect-runtime-integration-tests-refactoring branch from 1772bef to a002489 Compare January 3, 2025 03:30
@wombatu-kun wombatu-kun requested a review from bryanck January 3, 2025 03:57
@bryanck
Copy link
Contributor

bryanck commented Jan 4, 2025

Thanks for the cleanup @wombatu-kun !

@bryanck bryanck merged commit fcd5dd9 into apache:main Jan 4, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants