Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead code with side effect in test OpenshiftAPIServiceTest #167

Open
barkbay opened this issue Dec 13, 2018 · 2 comments
Open

Dead code with side effect in test OpenshiftAPIServiceTest #167

barkbay opened this issue Dec 13, 2018 · 2 comments

Comments

@barkbay
Copy link

barkbay commented Dec 13, 2018

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.

@barkbay
Copy link
Author

barkbay commented Dec 13, 2018

This issue blocks #111

@jcantrill
Copy link
Collaborator

@barkbay please feel free to submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants