Open chunxue-ding opened 7 months ago
Do I need to install zk in my local environment ?
Currently there are two classes of tests in the library; unit tests, and integrations tests.
Any test case with the work Integration
assumes a local zookeeper setup. What we have currently done is wrapped this in the Makefile.
To run all the non-integration tests we can run make unittest
to run pure Go tests without needing any external dependencies.
make test
will download and setup the required zookeeper binaries to run the integration tests.
The PR process will expect all tests to pass, including the Integration ones.
Another way if you are using an Editor or IDE that runs tests on save, you can have the go test flags exclude these tests with -skip=Integration
as a flag to go test.
Thank you for your reply,Because I'm testing a function method in a local environment that calls a zk query method, and the client creation of the zk is inside the zk query method, not outside the zk query method and passed in as an argument, this causes me to mock out a virtual ZK client when I do the unit test of the function method. Because this is possible for etcd before, would you like to know if there is a similar method for zk
I pull down the code for the master branch ,and run the zk_test test file,The function method is TestIntegration_Create ,Then an error was reported,Debugging indicates that an error occurs in the StartTestCluster method . error message is received unexpected error: zk: could not find testing zookeeper bin path at "zookeeper/bin": CreateFile zookeeper/bin: The system cannot find the path specified.