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

fix(template): correct return of String-encoded Optional #482

Merged
merged 8 commits into from
May 30, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented May 29, 2024

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Fixes: #481

Description of the change:

There was a bit of jumbled handling of an Optional in the implementation from #449, which resulted in an Optional that wrapped around another Optional#toString() call erroneously. The original Optional itself is the expected return, not its String form.

This got missed because the test doesn't run in CI. I think this is because of the Maven property to not build container images during CI. This probably made sense previously when there were no real tests to run and so building the container image as a throwaway was just a waste of CI time, but now there are integration tests to be run which do need the container image to have been built first.

How to manually test:

  1. Check out PR
  2. ./mvnw clean verify ; podman image prune -f. All tests should pass
  3. ./smoketest.bash -O, once the test comes up open the UI and start a recording on Cryostat itself using localhost:0 using the Cryostat template. Go to Security and define a stored credential that matches cryostat3:9091 with cryostat:password, create another stored credential with false and test:test, go back to Recordings and select cryostat3:9091. Then download the recording you started and open it with JMC. Go to the Event Browser and verify that the events were captured.

Screenshot_2024-05-29_16-08-06

@andrewazores
Copy link
Member Author

/build_test

Copy link

Workflow started at 5/29/2024, 3:20:05 PM. View Actions Run.

Copy link

No OpenAPI schema changes detected.

Copy link

No GraphQL schema changes detected.

Copy link

CI build and push: At least one test failed ❌ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/9291897968

@andrewazores
Copy link
Member Author

andrewazores commented May 29, 2024

I'm not sure what's up with the CI failure. It got to the point of running the test, but the test failed because the expected event template wasn't found. I'm not sure how that can be the case. This test passes locally, and I can't remember the exact reason I initially had this test disabled in CI only - I suppose it was also failing in CI, but I don't quite understand what that is the case. Maybe it has to do with the fact that the CI action passes the Maven property to not build a container image, but I would expect that to either cause the tests not to run or to run with an outdated image, and even a very outdated image should still contain that template file.

https://github.com/cryostatio/cryostat3/blame/main/src/test/java/itest/CryostatTemplateIT.java#L35

#151

@andrewazores andrewazores requested a review from a team as a code owner May 29, 2024 19:52
@andrewazores
Copy link
Member Author

/build_test

Copy link

Workflow started at 5/29/2024, 4:09:17 PM. View Actions Run.

Copy link

No GraphQL schema changes detected.

Copy link

No OpenAPI schema changes detected.

Copy link

CI build and push: At least one test failed ❌ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/9292460096

@andrewazores
Copy link
Member Author

./mvnw -Dquarkus.container-image.build=true clean verify ; podman image prune -f fails locally.

./mvnw -Dquarkus.container-image.build=false clean verify ; podman image prune -f or ./mvnw clean verify ; podman image prune -f passes.

It seems like if the image doesn't get built then the tests run with a local process version of Cryostat. The cryostat.jfc file that the test is looking for gets inserted as an additional asset at container build time, so in this scenario it's expected that the template is not present. If the container does get built then the test runner runs using that, which does contain the template.

So once this is merged and the CI action change takes effect this should pass in CI as well.

@andrewazores andrewazores requested review from aali309 and mwangggg May 29, 2024 20:31
Copy link
Contributor

@aali309 aali309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@andrewazores andrewazores merged commit 20d0b66 into cryostatio:main May 30, 2024
7 checks passed
@andrewazores andrewazores deleted the gh481 branch May 30, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants