Closed lukas-vlcek closed 7 years ago
The following are some questions I would love to discuss more:
I had to do some simple exclusion work in pom.xml
to pass Elasticsearch Jar Hell check.
Solved, see #issuecomment-312305191
Currently, when running from command line or from IDE I need to make sure Java security manager is turned off:
mvn -Dtests.security.manager=false clean test
With security manager I am running into errors like:
access denied ("java.io.FilePermission" "/Users/lvlcek/projects/lukas-vlcek/openshift-elasticsearch-plugin/src/test/resources/elasticsearch/config/admin.jks" "read")
and I do nut fully understand why. Based on this comment it seems this should be doable. I need to investigate this further. May be you have some ideas?
Right now, I point SG to jks files in src/test/resource/elasticsearch/config/
. At this moment those files are just empty text files and my tests are failing due to this (this is expected). However, my question would be, do you think we will be able to generate these files on the fly or use some other mechanism (ideally maven friendly) to provide SSL certificates and point SG to them?
If there will be need to interact with Kubernetes service during tests I hope to be able to implement mock for it (do you see any issues with this?). Heads up remined is that we might need to switch from Mockito to securemock.
@lukas-vlcek This plugin depends upon fabric8 implementation of kubernetes-client/openshift-client which uses okhttp. Additionally, they provide a mock library to be used for testing. I have not used it, but I believe that would allow you to mock out the back end. @jimmidyson can you point @lukas-vlcek to examples?
We provide mocks for pretty much everything. Examples in the test cases in the client itself, e.g. https://github.com/fabric8io/kubernetes-client/tree/master/openshift-client/src/test/java/io/fabric8/openshift/client/mock & https://github.com/fabric8io/kubernetes-client/tree/master/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock
ATM I still need to figure out how to configure Java security manager for integration tests. It seems Elastic developers run into the same problem. Let's see if their solution can help us.
I was able to provide Java security manager configuration just for the maven-failsafe-plugin
plugin which seem to fixes the problem. Travis tests are now passing without security manager issues for both unit and integration tests!
closing in favor of #105
This is WIP - DO NOT MERGE
Goals
Add integration tests with real Elasticsearch cluster. All tests will be strictly separated to unit tests and integration tests .
Unit tests will reside under
src/test/*
and execution will be handled bymaven-surefire-plugin
. Integration tests will reside undersrc/it/*
and execution will be handled bymaven-failsafe-plugin
.Tasks