-
Notifications
You must be signed in to change notification settings - Fork 315
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
test: Improve integration test framework #295
test: Improve integration test framework #295
Conversation
thirdNode.start(); | ||
endpoints = TestUtil.buildClientEndpoints(firstNode, secondNode, thirdNode); | ||
peerUrls = TestUtil.buildPeerEndpoints(firstNode, secondNode, thirdNode); | ||
TimeUnit.SECONDS.sleep(5); |
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.
Client was saying, that cluster is unhealthy
. So I gave him some time here
@IgorPerikov Thanks for the pr. I give this a thought. If we can wrap all the etcd containers creation logic into a new class called /**
* Cluster is an etcd cluster.
*/
public interface Cluster {
// randClient randomly picks a etcd client within the cluster.
Client randClient();
// client gets the member client based on member idx within the cluster.
Client client(int i);
// terminate terminates the etcd cluster.
void terminate();
} Also a factory class to create it. public class ClusterFactory {
// newCluster returns a launched cluster with client connection
// for each cluster member.
public static Cluster newCluster(int size) {
return null;
}
} Let me know what you think. also the above idea is based on the integration test framework from etcd. ref: https://github.com/coreos/etcd/blob/master/integration/cluster.go#L1000 cc/ @lburgazzoli |
I'm not exactly agree with |
@fanminshi I've pushed draft of the cluster abstraction. There might be still some small mistakes/bad namings or so, but general idea is there. More about some design decisions I've made:
|
|
@@ -221,4 +227,9 @@ public void testNestedTxn() throws Exception { | |||
test.assertEquals(getResp2.getKvs().size(), 1); | |||
test.assertEquals(getResp2.getKvs().get(0).getValue().toStringUtf8(), oneTwoThree.toStringUtf8()); | |||
} | |||
|
|||
@AfterTest | |||
public void stop() throws IOException { |
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 use public void tearDown()
instead? that is being used in everywhere else i think.
@@ -117,4 +121,9 @@ public void testMoveLeader() throws ExecutionException, InterruptedException { | |||
client.getMaintenanceClient().moveLeader(followers.get(0)).get(); | |||
} | |||
} | |||
|
|||
@AfterTest | |||
public void stopContainers() throws IOException { |
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.
use public void tearDown()
?
@IgorPerikov the new interface looks great! just some nits then lgtm. thanks for the great work! |
Also after you have addressed my comments/suggestions, could you also rebase the commits? e.g If you can follow the commit style guide line from here will be great: https://github.com/coreos/etcd/blob/master/CONTRIBUTING.md#format-of-the-commit-message |
@IgorPerikov kindly ping? |
@fanminshi Hi! I had a day off, and I'm gonna do the rest of the pr-related work tonight, stay tuned! |
@fanminshi done |
according to this issue #106
this pull request