-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use admin client to confirm cluster is correctly started #24
Use admin client to confirm cluster is correctly started #24
Conversation
Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
Option 3 seems least worst to me. I prefer the clean separation of concerns that a dedicated listener gives us. It will be easier to identify in the logs too, which I expect we'll appreciate when debugging thorny issues. |
impl/src/main/java/io/kroxylicious/testing/kafka/common/Utils.java
Outdated
Show resolved
Hide resolved
impl/src/test/java/io/kroxylicious/testing/kafka/common/KafkaClusterConfigTest.java
Show resolved
Hide resolved
Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
b92cf1b
to
0bcdc64
Compare
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 left a few nits, but otherwise LGTM.
impl/src/main/java/io/kroxylicious/testing/kafka/common/KafkaClusterConfig.java
Outdated
Show resolved
Hide resolved
impl/src/main/java/io/kroxylicious/testing/kafka/common/KafkaClusterConfig.java
Outdated
Show resolved
Hide resolved
impl/src/main/java/io/kroxylicious/testing/kafka/common/KafkaClusterConfig.java
Outdated
Show resolved
Hide resolved
@@ -388,11 +434,23 @@ public interface KafkaEndpoints { | |||
class EndpointPair { | |||
private final Endpoint bind; | |||
private final Endpoint connect; | |||
|
|||
public String connectAddress() { | |||
return String.format("%s:%d", connect.host, connect.port); |
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 %d
is locale-dependent, according to the "Number Localization Algorithm" section in Formatter
Javadoc, which says:
Each digit character d in the string is replaced by a locale-specific digit computed relative to the current locale's zero digit z;
To avoid this I would use concatenation using +
.
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.
public char getZeroDigit()
Gets the character used for zero. Different for Arabic, etc.
Wow, I never knew that. I've written so much code that must fall on its face in the Arabic world.
} | ||
|
||
@Override | ||
public EndpointPair getControllerEndpoint(int brokerId) { | ||
// TODO why can't we treat ZK as the controller port outside of kraft mode? |
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.
Open an issue if this is worthy of further investigation.
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.
Opened #25 replied to wrong comment.
impl/src/main/java/io/kroxylicious/testing/kafka/invm/InVMKafkaCluster.java
Outdated
Show resolved
Hide resolved
impl/src/main/java/io/kroxylicious/testing/kafka/common/Utils.java
Outdated
Show resolved
Hide resolved
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.
Looks good to me.
…ial into the cluster Signed-off-by: Sam Barker <[email protected]>
Co-authored-by: Tom Bentley <[email protected]>
…uster` Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
Signed-off-by: Sam Barker <[email protected]>
Matches with kroxylicious-parent. Signed-off-by: Sam Barker <[email protected]>
2269249
to
8475323
Compare
Uses an admin client to describe the cluster and ensure the expected number of brokers are included before injecting into tests.
The one snag this faces is when authentication comes into play.
Initially I tried to connect to the inter-broker listener however that's not currently exposed to the host when running in test containers. So switched back to using the client listener. When that is authenticated the default admin client is unable to connect.
I see three possible solutions.
Separately I think there is some additional refactoring to do around how endpoints are defined and used to generate the various different formats of host and port required. i.e. clients don't like resolving
//localhost:9093
and listeners don't likelocalhost:9093
.Fixes #7