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

test(certificates): Add SSL certificate itests #608

Merged
merged 3 commits into from
Jul 28, 2021

Conversation

jan-law
Copy link
Contributor

@jan-law jan-law commented Jul 27, 2021

Related #474

Tests for null file uploads and conflicting file names that already exist in the truststore.

Question: If the /truststore directory is not mounted for integration tests, how can I test the following in CertificatePostHandler line 151?

if (fs.exists(filePath)) {
            throw new ApiException(409, filePath.toString() + " Certificate already exists");
        }

@jan-law jan-law requested a review from andrewazores July 27, 2021 17:51
@andrewazores
Copy link
Member

andrewazores commented Jul 27, 2021

/truststore doesn't need to be mounted necessarily, like it's done in run.sh - this would allow the contents to be written to the host filesystem, but that's more than what's really needed for itest purposes. As long as the Cryostat instance under test is able to store the certificate for its single-run lifetime then that would be sufficient. So, a tmpfs mount would fit the bill. In pom.xml we do already mount tmpfs to some directories, ex:

              <argument>--mount</argument>
              <argument>type=tmpfs,target=/opt/cryostat.d/recordings.d</argument>

Adding another itest setup argument like this to mount the certificates storage directory (and possibly to set an environment variable telling Cryostat where that directory is within its container at runtime) should do the trick. After that you can test that the first POST succeeds and a subsequent identical POST fails with a 409.

@jan-law jan-law force-pushed the itest-cert-upload branch from 7bb3963 to 3d9c0bd Compare July 27, 2021 20:59
@jan-law jan-law marked this pull request as ready for review July 27, 2021 21:10
@jan-law
Copy link
Contributor Author

jan-law commented Jul 27, 2021

I've finished making changes, ready for review

andrewazores
andrewazores previously approved these changes Jul 27, 2021
@andrewazores
Copy link
Member

Rebase please - I don't expect any conflicts between this commit and the last, but just to be sure.

@jan-law jan-law force-pushed the itest-cert-upload branch from eb85807 to 81445ef Compare July 28, 2021 14:02
@andrewazores andrewazores merged commit b059c58 into cryostatio:main Jul 28, 2021
@jan-law jan-law deleted the itest-cert-upload branch July 29, 2021 14:06
tthvo pushed a commit to tthvo/cryostat-legacy that referenced this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants