-
Notifications
You must be signed in to change notification settings - Fork 14.7k
KAFKA-7503: Connect integration test harness #5516
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
Closed
Closed
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
ef610e3
Connect integration test harness (WIP)
wicknicks 97dc0fb
MINOR: Fix checkstyle issues
wicknicks 1ec70a5
MINOR: add util functions to produce and consume records
wicknicks 305a5d4
MINOR: Add monitorable sink connector
wicknicks b047825
Rename variable to producer
wicknicks 52d44ce
Add some javadocs
wicknicks b9b8c86
DLQ integration test
wicknicks 411b678
Wait for only limited time for records to come through
wicknicks c5c3494
Use REST endpoint to start/delete connectors
wicknicks 041490a
Use distributed herder to bring up connect cluster
wicknicks 9321248
Make checkstyle happy and setup and tear down clusters with @Before a…
wicknicks eaa9835
Clean up ConnectIntegrationTest and reset COUNTER in stop
wicknicks 054ba50
Address reviewer comments
wicknicks aa22a70
Reset log4j.properties to original state
wicknicks c6db65d
Clean up imports
wicknicks 50b9166
Align variable name to convention
wicknicks 708fd2d
Use a latch to wait for connector to sink records
wicknicks 63bfbb4
Test can wait till task is created instead of busy loop
wicknicks b9a1f19
Address other review comments
wicknicks bf72fc6
Make variables final
wicknicks 1f0e9f2
Remove unused imports
wicknicks b1def66
Add some javadoc and count down on latch when task exits
wicknicks 1fb10b8
Update ConnectIntegrationTest to use multiple topic partitions and tasks
wicknicks cdcfb9f
Changes to startConnector method
wicknicks 213b31c
Remove before() and after() methods from EmbeddedConnectCluster
wicknicks 2f235c0
Generate clusterName randomly instead of using argument
wicknicks 676721c
bootstrapServers() returns all brokers
wicknicks 4cc9a73
Throw exception if desired replicator is unachievable
wicknicks 7380c1d
Refactor logic for consuming up to n records in maxDuration
wicknicks b3cf19a
Remove unused methods
wicknicks 00d9177
Rename tests and broaden the scope of error handling test
wicknicks 1cc92a1
Clean up handles for tasks before starting the test
wicknicks af5ccd8
Correct some typos
wicknicks 56e504f
KAFKA-7503: Fix typos and remove unnecessary task props
wicknicks fa68baa
KAFKA-7503: Rename taskInstances method
wicknicks 3d91b8e
KAFKA-7503: Add documentation to clarify taskAvailable's contracts
wicknicks 91acd05
KAFKA-7503: Let Jetty pick any available port for integration tests
wicknicks 591f8de
KAFKA-7503: Multi worker connect cluster in integration tests
wicknicks 1d86332
KAFKA-7503: Add counters in connector handle
wicknicks dab22a1
KAFKA-7503: Remove unnecessary task handle cleanup requests
wicknicks 96d53f5
MINOR: Change example worker props
wicknicks 63cc56f
MINOR: Use better error message
wicknicks d4ba51d
TEMP: Modify log4j.properties to debug failing test
wicknicks 3af72cd
MINOR: Find free ports using ServerSocket API
wicknicks a9a3895
KAFKA-7503: Address reviewer comments
wicknicks 85d72fc
KAFKA-7503: Initialize RestServer before starting herder (#8)
wicknicks 016da0a
KAFKA-7503: Set REST_PORT_CONFIG to 0 for integration tests
wicknicks 6c6b5e4
MINOR: Suppress deprecation errors
wicknicks cc4d11b
KAFKA-7503: Replace premature exception with a warning
wicknicks c12fedd
KAFKA-7503: Add waitUntil and address reviewer comments
wicknicks 8b24c6f
KAFKA-7503: Use waitForCondition from TestUtils; throw error if Latch…
wicknicks 027e68e
KAFKA-7503: Fix call to RestServer#start in unit test
wicknicks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
68 changes: 68 additions & 0 deletions
68
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/HerderProvider.java
This file contains hidden or 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,68 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.connect.runtime; | ||
|
|
||
| import org.apache.kafka.connect.errors.ConnectException; | ||
|
|
||
| import java.util.concurrent.CountDownLatch; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| /** | ||
| * A supplier for {@link Herder}s. | ||
| */ | ||
| public class HerderProvider { | ||
|
|
||
| private final CountDownLatch initialized = new CountDownLatch(1); | ||
| volatile Herder herder = null; | ||
|
|
||
| public HerderProvider() { | ||
| } | ||
|
|
||
| /** | ||
| * Create a herder provider with a herder. | ||
| * @param herder the herder that will be supplied to threads waiting on this provider | ||
| */ | ||
| public HerderProvider(Herder herder) { | ||
| this.herder = herder; | ||
| initialized.countDown(); | ||
| } | ||
|
|
||
| /** | ||
| * @return the contained herder. | ||
| * @throws ConnectException if a herder was not available within a duration of calling this method | ||
| */ | ||
| public Herder get() { | ||
| try { | ||
| // wait for herder to be initialized | ||
| if (!initialized.await(1, TimeUnit.MINUTES)) { | ||
| throw new ConnectException("Timed out waiting for herder to be initialized."); | ||
| } | ||
| } catch (InterruptedException e) { | ||
| throw new ConnectException("Interrupted while waiting for herder to be initialized.", e); | ||
| } | ||
| return herder; | ||
| } | ||
|
|
||
| /** | ||
| * @param herder set a herder, and signal to all threads waiting on get(). | ||
| */ | ||
| public void setHerder(Herder herder) { | ||
| this.herder = herder; | ||
wicknicks marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| initialized.countDown(); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It might be even more valuable to break this method into multiple protected methods and to have more of the components created in this method be members. However, that's probably work for another ticket.