-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-16935: Automatically wait for cluster startup in embedded Connect integration tests #16288
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,8 +72,6 @@ public void testCreateInternalTopicsWithDefaultSettings() throws InterruptedExce | |
|
|
||
| // Start the Connect cluster | ||
| connect.start(); | ||
| connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Brokers did not start in time."); | ||
| connect.assertions().assertExactlyNumWorkersAreUp(numWorkers, "Worker did not start in time."); | ||
| log.info("Completed startup of {} Kafka brokers and {} Connect workers", numBrokers, numWorkers); | ||
|
|
||
| // Check the topics | ||
|
|
@@ -111,9 +109,6 @@ public void testCreateInternalTopicsWithFewerReplicasThanBrokers() throws Interr | |
|
|
||
| // Start the Connect cluster | ||
| connect.start(); | ||
| connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Broker did not start in time."); | ||
| connect.assertions().assertAtLeastNumWorkersAreUp(numWorkers, "Worker did not start in time."); | ||
| log.info("Completed startup of {} Kafka brokers and {} Connect workers", numBrokers, numWorkers); | ||
|
|
||
| // Check the topics | ||
| log.info("Verifying the internal topics for Connect"); | ||
|
|
@@ -126,7 +121,7 @@ public void testFailToCreateInternalTopicsWithMoreReplicasThanBrokers() throws I | |
| workerProps.put(DistributedConfig.CONFIG_STORAGE_REPLICATION_FACTOR_CONFIG, "3"); | ||
| workerProps.put(DistributedConfig.OFFSET_STORAGE_REPLICATION_FACTOR_CONFIG, "2"); | ||
| workerProps.put(DistributedConfig.STATUS_STORAGE_REPLICATION_FACTOR_CONFIG, "1"); | ||
| int numWorkers = 1; | ||
| int numWorkers = 0; | ||
| int numBrokers = 1; | ||
| connect = new EmbeddedConnectCluster.Builder().name("connect-cluster-1") | ||
| .workerProps(workerProps) | ||
|
|
@@ -137,11 +132,14 @@ public void testFailToCreateInternalTopicsWithMoreReplicasThanBrokers() throws I | |
|
|
||
| // Start the brokers and Connect, but Connect should fail to create config and offset topic | ||
| connect.start(); | ||
| connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Broker did not start in time."); | ||
| log.info("Completed startup of {} Kafka broker. Expected Connect worker to fail", numBrokers); | ||
|
|
||
| // Try to start a worker | ||
| connect.addWorker(); | ||
|
|
||
| // Verify that the offset and config topic don't exist; | ||
| // the status topic may have been created if timing was right but we don't care | ||
| // TODO: Synchronously await and verify that the worker fails during startup | ||
| log.info("Verifying the internal topics for Connect"); | ||
| connect.assertions().assertTopicsDoNotExist(configTopic(), offsetTopic()); | ||
| } | ||
|
|
@@ -169,7 +167,6 @@ public void testFailToStartWhenInternalTopicsAreNotCompacted() throws Interrupte | |
| // Start the brokers but not Connect | ||
| log.info("Starting {} Kafka brokers, but no Connect workers yet", numBrokers); | ||
| connect.start(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh interesting, this sets numWorkers=0, and therefore can call the blocking start() method safely. WDYT about changing testFailToCreateInternalTopicsWithMoreReplicasThanBrokers to use the same pattern? That would eliminate the need for the non-blocking start method, and simplify the control flow. The minority of call-sites are going to expect the workers to fail to start up, so I think it's okay to use a workaround instead of giving them a first-class method.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to rework
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For downstream users intentionally giving the embedded connect bad configs, they will need to alter the test anyway, so I'd prefer that they follow the pattern used by upstream. I don't think that anyone should really be relying on this behavior, otherwise I would make an argument for start() remaining non-blocking (which i definitely don't want).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a great point. I've removed the overloaded variant and tweaked the only remaining integration test that uses it. That test itself is actually subtly broken since it doesn't (and never did) synchronously wait for worker startup before checking that internal topics don't exist, but since this PR doesn't introduce a regression I've thrown a TODO into the codebase and left everything else for a follow-up. |
||
| connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Broker did not start in time."); | ||
| log.info("Completed startup of {} Kafka broker. Expected Connect worker to fail", numBrokers); | ||
|
|
||
| // Create the good topics | ||
|
|
@@ -243,7 +240,6 @@ public void testStartWhenInternalTopicsCreatedManuallyWithCompactForBrokersDefau | |
| // Start the brokers but not Connect | ||
| log.info("Starting {} Kafka brokers, but no Connect workers yet", numBrokers); | ||
| connect.start(); | ||
| connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Broker did not start in time."); | ||
| log.info("Completed startup of {} Kafka broker. Expected Connect worker to fail", numBrokers); | ||
|
|
||
| // Create the valid internal topics w/o topic settings, so these will use the broker's | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.