[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-3557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16953468#comment-16953468
 ] 

Zili Chen edited comment on ZOOKEEPER-3557 at 10/17/19 7:29 AM:
----------------------------------------------------------------

Generally speaking I'm going to attempt to introduce a new module 
{{zookeeper-testkit}} which contains

src/main - classes as testkits that can be used in downstream project. Such as 
{{TestingServer}}.
src/test - we port current test cases to this directory for using the new 
testkit for a well-divided test cases(note that most of them messily coupled 
with {{ClientBase}})

this module depends on {{zookeeper-server}}.

Another notable things is that project like Curator makes use of {{Testable}} 
which provide {{injectSessionExpiration}} which I think is a useful API for 
client self close the connection(for an edge case can be taken care of with 
this API see also [this 
thread|https://lists.apache.org/x/thread.html/89b7717f6b05556ff381350d515c5afdd15b80442b934e25a2dad398@%3Cuser.zookeeper.apache.org%3E])
 CC [~randgalt]


was (Author: tison):
Generally speaking I'm going to attempt to introduce a new module 
{{zookeeper-testkit}} which contains

src/main - testable classes that can be used in downstream project. Such as 
{{TestingServer}}.
src/test - we port current test cases to this directory for using the new 
testkit for a well-divided test cases(note that most of them messily coupled 
with {{ClientBase}})

this module depends on {{zookeeper-server}}.

Another notable things is that project like Curator makes use of {{Testable}} 
which provide {{injectSessionExpiration}} which I think is a useful API for 
client self close the connection(for an edge case can be taken care of with 
this API see also [this 
thread|https://lists.apache.org/x/thread.html/89b7717f6b05556ff381350d515c5afdd15b80442b934e25a2dad398@%3Cuser.zookeeper.apache.org%3E])
 CC [~randgalt]

> Towards a testable codebase
> ---------------------------
>
>                 Key: ZOOKEEPER-3557
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3557
>             Project: ZooKeeper
>          Issue Type: Task
>          Components: tests
>            Reporter: Zili Chen
>            Priority: Major
>
> This issue is umbrella issue tracks all efforts towards a testable ZooKeeper 
> codebase.
> *Motivation*
> On the one hand, many of our adopters such as HBase, Curator and so on 
> maintain their own testkit for ZooKeeper[1][2]; on the other hand, ZooKeeper 
> itself doesn't have a well-designed testkit. Here are some of issues in our 
> testing "framework".
> 1. {{ZooKeeperTestable}} becomes a production scope class while it should be 
> in testing scope.
> 2. {{ZooKeeperTestable}} is only used in {{SessionTimeoutTest}} while its 
> name infers a completed testing class.
> 3. {{ClientBase}} is super class of many of zookeeper tests while it contains 
> too many orthogonal functions that its subclass inherits lots of burdens that 
> is not required.
> 4. Testing logics are injected casually so that we suffer from visibility 
> chaos.
> ...
> Due to ZooKeeper doesn't provide testkit our adopters have to write ZK 
> relative tests with quite internal concepts. For example, HBase wait for ZK 
> server launched by 4 letter words which causes issue when upgrade from ZK 
> 3.4.x to ZK 3.5.5 where 4 letter words are disabled by default.
> [1] 
> https://github.com/apache/hbase/blob/master/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java
> [2] 
> https://github.com/apache/curator/blob/master/curator-test/src/main/java/org/apache/curator/test/TestingCluster.java



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to