openshift-elasticsearch-plugin
openshift-elasticsearch-plugin copied to clipboard
Dead code with side effect in test OpenshiftAPIServiceTest
It looks like there is some dead code here :
@Before
public void setup() {
final String basedir = System.getProperty("project.basedir");
final String password = "changeit";
final String keyStore = basedir + "/src/it/resources/keystore.jks";
[...]
System.setProperty("kubernetes.keystore.file", keyStore);
[...]
}
System.getProperty("project.basedir")
always returns null
and the system property kubernetes.keystore.file
is always set to null/src/it/resources/keystore.jks
Please also note that tests are not failing if you delete the file src/it/resources/keystore.jks
, so it looks like this file is not used too.
Looking at the pom.xml I guess that the first idea was to use the environment variable PROJECT_DIR
:
...
<environmentVariables>
<ENV_VAR_EXISTS>value</ENV_VAR_EXISTS>
<ENV_VAR_EXISTS_BOOLEAN>true</ENV_VAR_EXISTS_BOOLEAN>
<PROJECT_DIR>${project.basedir}</PROJECT_DIR>
</environmentVariables>
...
System.getProperty("project.basedir")
should be replaced with System.getenv("PROJECT_DIR")
The problem is that by setting a wrong system property with System.setProperty("..")
without further cleanup with a @After
it has some side effects on other piece of code.
This issue blocks #111
@barkbay please feel free to submit a pull request.