-
Notifications
You must be signed in to change notification settings - Fork 52
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
abolish scala. make test harnesses java, avoid any link-time dependency on scala #65
abolish scala. make test harnesses java, avoid any link-time dependency on scala #65
Conversation
3cfb079
to
ad23b2c
Compare
ad23b2c
to
a62227e
Compare
@@ -17,12 +17,13 @@ | |||
public interface UUIDFactory<K, V> extends Configurable { | |||
|
|||
/** | |||
* Get a random UUID. | |||
* @return a random UUID |
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.
If you are cleaning up documentation then you might as well change this to something like "a non-null UUID". The UUID does not need to be random.
@@ -1052,6 +1055,14 @@ private void produceSyntheticMessages(String topic) { | |||
producer.close(); | |||
} | |||
|
|||
//TODO - remove / refactor | |||
private Producer<byte[], byte[]> createKafkaProducer() { |
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.
Should we default all tests to SSL?
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.
no. this method is rather hacky and creates an ad-hoc producer<byte[], byte[]> where the rest of the harness code creates <string, string>, and so should be cleaned up somehow.
however, our tests currently rely on this heavily nd i didnt want ot make this PR any bogger.
@Override | ||
public void tearDown() { | ||
try { | ||
//TODO - something here ? |
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.
Eh?
|
||
//apply overrides | ||
if (overrides != null) { | ||
overrides.forEach(result::put); |
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.
result.putAll(overrides)?
} | ||
|
||
|
||
protected List<Map<Object, Object>> buildBrokerConfigs() { |
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 useful to add documentation about this return value so the user knows that returnValue.get(i) is a config for the ith broker.
package com.linkedin.kafka.clients.utils.tests; | ||
|
||
public abstract class AbstractZookeeperTestHarness { | ||
protected EmbeddedZookeeper zookeeper = null; |
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.
zookeeper -> _zookeeper
f8054e7
to
527daec
Compare
src/test/resources/log4j.properties
Outdated
@@ -2,7 +2,7 @@ | |||
# Copyright 2017 LinkedIn Corp. Licensed under the BSD 2-Clause License (the "License"). See License in the project root for license information. | |||
# | |||
|
|||
log4j.rootLogger=OFF, stdout | |||
log4j.rootLogger=DEBUG, stdout |
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.
Accidental change?
@@ -0,0 +1,26 @@ | |||
/* |
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 test is really weird....
@@ -50,7 +47,7 @@ public int clusterSize() { | |||
@Override | |||
public Properties overridingProps() { | |||
Properties props = new Properties(); | |||
props.setProperty(KafkaConfig.NumPartitionsProp(), Integer.toString(NUM_PARTITIONS)); | |||
props.setProperty("num.partitions", Integer.toString(NUM_PARTITIONS)); |
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 seems safer to use the method instead of hard coding it.
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.
that prop is in scala code. it is unclean ...
try { | ||
FileUtils.forceDelete(toCleanUp); | ||
} catch (IOException issue) { | ||
issue.printStackTrace(System.err); |
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.
Maybe rethrow the exception to let the uncaught exception handler handle it.
return consumer; | ||
} | ||
|
||
public static int getAvailableTcpPort() { |
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.
Can we reuse the KafkaServer.boundPort()
method and ZookeeperServer.getClientPort()
instead of writing our own method?
} | ||
} else { | ||
if (trustStoreFile() != null) { | ||
throw new AssertionError("security protocol not yet yet trust store file provided"); |
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 don't understand this error message.
private final static Method SHUTDOWN_METHOD; | ||
private final static Method AWAIT_SHUTDOWN_METHOD; | ||
private final static Object EMPTY_OPTION; | ||
private final static Pattern LISTENER_PATTERN = Pattern.compile("\\s*(\\w+)://([\\w\\d]+):(\\d+)\\s*"); |
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 won't match IPv6 addresses which someone might want to use if they were testing that IPv6 worked.
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.
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.
Probably the \s* at the beginning and end is not needed if matcher.find() is used.
return this; | ||
} | ||
|
||
public EmbeddedBrokerBuilder trustStore(File trustStore) { |
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.
Do the trust stores need to be files or can they be resources so that you can package truststores in the source code.
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 scala harness uses a File as a trust store, and i matched it.
also, this is test code, i see no use case for packaging trust stores into the artifacts ?
private final static List<File> FILES_TO_CLEAN_UP = Collections.synchronizedList(new ArrayList<>()); | ||
|
||
static { | ||
SHUTDOWN_HOOK = new Thread(() -> { |
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 just here just in case tear down does not work?
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.
no. closable test classes (like embeddable brokers and zk) should delete their files on close, but other tests may need files/folders
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.
LGTM.
No description provided.