acceptance: need to refactor the Java acceptance tests
Suggestions collected over #4578:
- Java code should be in separate .java files (eases editing)
- there should be no preprocessing (different files are best)
- the different Java tests should be executed one after another by test logic written in Java
- the filesystem in the test docker instance should not be polluted by generated files
@knz, you mean we should write separate .java files instead of java_test.go
@a6802739 yes that is correct.
@knz , thanks, another question, where is the code to control all the execute logic in acceptance. is it run.sh?
Yes, acceptance/run.sh calls go test which in turn runs all the Go tests defined in the directory.
You can also run make acceptance from the top-level directory, which will do the same thing.
@knz , if I change java_test.go to separate .java files. I should also change run.sh and makefile, right?
Yes you can approach it this way.
Meanwhile to align with our other tests I could also suggest 1 Go acceptance test function which:
- starts the test DB server
- invokes the Java compiler to compile the Javatest code (and checks there are no compile errors)
- with a loop runs each test Java program, giving it the DB connection string as argument each time
- when all Java tests have run, stops the test DB server
Of course if you have a better idea please go forward with it.
@knz, thanks for you advice.
@knz, I would like work on this issue. I have on question though. How are we supposed to copy the .java files from our host to the docker container after it is started?
Presently, we are creating these .java files on the container by executing a bash script on the container itself. Right?
Hi @rohangulati! Thanks for offering to help!
When a docker test starts the full CockroachDB source directory is "mounted" inside the docker image in location /go/src/github.com/cockroachdb/cockroach. If you place the .java files somewhere in acceptance/ (e.g. acceptance/java/) you can then access them inside the docker image from /go/src/github.com/cockroachdb/cockroach/acceptance/java. Let me know if you have more questions.