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(scorecard): add custom target discovery to recording scorecard test #8

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

mwangggg
Copy link

Welcome to Cryostat! 👋

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: git commit -S -m "YOUR_COMMIT_MESSAGE"

Related to: cryostatio#504

@mwangggg mwangggg marked this pull request as ready for review February 27, 2024 23:57
@mwangggg mwangggg force-pushed the 698-rec-scorecard-cont branch 2 times, most recently from 7d137a5 to 701c7d9 Compare February 28, 2024 00:05
@mwangggg
Copy link
Author

/build_test

@mwangggg
Copy link
Author

oh I guess I can't do that here..

@andrewazores
Copy link

Looks reasonable to me.

@ebaron
Copy link

ebaron commented Feb 28, 2024

This has been passing much more reliably for me than with the built-in discovery. Although about 1/10th of the time I'll get the following EOF:

 --------------------------------------------------------------------------------
 Image:      quay.io/ebaron/cryostat-operator-scorecard:mwangggg-698-rec-scorecard-cont-01
 Entrypoint: [cryostat-scorecard-tests cryostat-recording]
 Labels:
     "suite":"cryostat"
     "test":"cryostat-recording"
 Results:
     Name: cryostat-recording
     State: fail

     Errors:
         failed to archive the recording: Patch "https://cryostat-recording-cryostat-operator-scorecard.apps.example.com/api/v1/targets/service:jmx:rmi:%2F%2F%2Fjndi%2Frmi:%2F%2Flocalhost:0%2Fjmxrmi/recordings/scorecard_test_rec": EOF
     Log:
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet found
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is not yet available
         deployment cryostat-recording is available
         application is available at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         application is not yet reachable at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         application is not yet reachable at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         application is not yet reachable at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         application is not yet reachable at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         application is ready at https://cryostat-recording-cryostat-operator-scorecard.apps.example.com
         created a custom target: &{ConnectUrl:service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi Alias:customTarget}
         created stored credential with match expression: target.alias=="customTarget"
         created a recording: &{DownloadURL:https://cryostat-recording-cryostat-operator-scorecard.apps.example.com:443/api/v1/targets/service:jmx:rmi:%2F%2F%2Fjndi%2Frmi:%2F%2Flocalhost:0%2Fjmxrmi/recordings/scorecard_test_rec ReportURL:https://cryostat-recording-cryostat-operator-scorecard.apps.example.com:443/api/v1/targets/service:jmx:rmi:%2F%2F%2Fjndi%2Frmi:%2F%2Flocalhost:0%2Fjmxrmi/reports/scorecard_test_rec Id:1 Name:scorecard_test_rec StartTime:1709136597936 State:RUNNING Duration:0 Continuous:true ToDisk:true MaxSize:0 MaxAge:0}
         current list of recordings: [{DownloadURL:https://cryostat-recording-cryostat-operator-scorecard.apps.8a7548441a03cb1654f8.hypershift.aws-2.ci.openshift.org:443/api/v1/targets/service:jmx:rmi:%2F%2F%2Fjndi%2Frmi:%2F%2Flocalhost:0%2Fjmxrmi/recordings/scorecard_test_rec ReportURL:https://cryostat-recording-cryostat-operator-scorecard.apps.example.com:443/api/v1/targets/service:jmx:rmi:%2F%2F%2Fjndi%2Frmi:%2F%2Flocalhost:0%2Fjmxrmi/reports/scorecard_test_rec Id:1 Name:scorecard_test_rec StartTime:1709136597936 State:RUNNING Duration:0 Continuous:true ToDisk:true MaxSize:0 MaxAge:0}]

This seems a bit similar to the error we encountered with the built-in discovery. There are some things we can try on the Golang client side, like: https://stackoverflow.com/a/34474535. I'm not sure if that's what we're seeing though. Given that the tests seem more reliable now, I think we should get the tests merged and investigate further.

@mwangggg mwangggg force-pushed the 698-rec-scorecard-cont branch from 701c7d9 to 3d445c8 Compare February 28, 2024 21:35
@mwangggg mwangggg force-pushed the 698-rec-scorecard-cont branch from 3d445c8 to 8732859 Compare February 28, 2024 21:53
Copy link
Owner

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

This seems a bit similar to the error we encountered with the built-in discovery. There are some things we can try on the Golang client side, like: https://stackoverflow.com/a/34474535. I'm not sure if that's what we're seeing though. Given that the tests seem more reliable now, I think we should get the tests merged and investigate further.

Hey @ebaron Looks like some rate limit issue (not sure though)?. Maybe another option can be a retry when EOF is encountered?

Something like a wait loop with a check for errors.Is(err, io.EOF)?

@ebaron
Copy link

ebaron commented Feb 28, 2024

This seems a bit similar to the error we encountered with the built-in discovery. There are some things we can try on the Golang client side, like: https://stackoverflow.com/a/34474535. I'm not sure if that's what we're seeing though. Given that the tests seem more reliable now, I think we should get the tests merged and investigate further.

Hey @ebaron Looks like some rate limit issue (not sure though)?. Maybe another option can be a retry when EOF is encountered?

Something like a wait loop with a check for errors.Is(err, io.EOF)?

That sounds like a good idea!

@andrewazores
Copy link

Would it also be possible to dump out the response status code and headers when there's a failure? That could also help a lot with troubleshooting - it could tell us what the server thinks went wrong, or if it is some kind of rate-limiting behaviour then we should be able to tell that the response actually came from the Service/Ingress/etc., too.

@tthvo
Copy link
Owner

tthvo commented Feb 29, 2024

Would it also be possible to dump out the response status code and headers when there's a failure? That could also help a lot with troubleshooting - it could tell us what the server thinks went wrong, or if it is some kind of rate-limiting behaviour then we should be able to tell that the response actually came from the Service/Ingress/etc., too.

Sure good idea! The test currently emits a status code and response body on non-200 code. I can also log out headers too.

https://pkg.go.dev/net/http#Response

Copy link
Owner

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Changes look good to me! We will note the ideas/suggestions above down and continue on upstream!

@tthvo tthvo merged commit fe00c92 into tthvo:recording-scorecard Feb 29, 2024
3 checks passed
@mwangggg mwangggg deleted the 698-rec-scorecard-cont branch March 12, 2024 15:26
tthvo pushed a commit that referenced this pull request Mar 27, 2024
* Merge pull request #8 from ebaron/scorecard-methods

test(scorecard): use methods for more easily passing data

* update bundle image
tthvo pushed a commit that referenced this pull request Apr 4, 2024
…atio#782)

* Merge pull request #8 from ebaron/scorecard-methods

test(scorecard): use methods for more easily passing data

* update bundle image

(cherry picked from commit b397095)

Co-authored-by: Ming Yu Wang <90855268+mwangggg@users.noreply.github.com>
tthvo added a commit that referenced this pull request Apr 24, 2024
* feat(discovery): options to configure discovery port names and numbers (backport cryostatio#715) (cryostatio#725)

* feat(discovery): options to configure discovery port names and numbers (cryostatio#715)

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>
(cherry picked from commit a552021)

* resolve conflict

---------

Co-authored-by: Thuan Vo <thuan.votann@gmail.com>
Co-authored-by: Andrew Azores <aazores@redhat.com>

* Deploy cryostat 3.0

* Remove extraneous file

* test adjustments

* feat(discovery): options to configure discovery port names and numbers (cryostatio#715)

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>

* Fix typo in environment variable breaking reconciler test, fix missing SecurityContext

* Fix conflict with cluster cryostat removal

* ci(gh): add comment when /build_test is finished (cryostatio#745)

* add scorecard test/suite selection (cryostatio#746)

* test(scorecard): scorecard tests for recording management (cryostatio#698)

* test(scorecard): scorecard tests for recording management

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>

* fixup(scorecard): fix cr cleanup func

* test(scorecard): registry recording test to suite

* chore(scorecard): reorganize client def

* chore(scorecard): clean up common setup func

* chore(bundle): regenerate bundle with scorecard tag

* chore(bundle): correct image tag in bundle

* fix(bundle): add missing scorecard test config patch

* feat(scorecard): scaffold cryostat API client

* chore(scorecard): clean up API client

* test(scorecard): implement recording scorecard test

* fixup(scorecard): correctly add scorecard test via hack templates

* fix(client): ignore unverified tls certs and base64 oauth token

* chore(bundle): split cryostat tests to separate stage

* fix(scorecard): extend default transport instead of overwriting

* chore(scorecard): refactor client to support multi-part

* fixup(client): fix request verb

* fix(client): fix recording create form format

* fix(scorecard): create stored credentials for target JVM

* fix(scorecard): fix 502 status error

* chore(scorecard): simplify client def

* chore(scorecard): fetch recordings to ensure action is correctly performed

* test(scorecard): test generating report for a recording

* chore(scorecard): clean up

* test(scorecard): list archives in tests

* ci(scorecard): reconfigure ingress for kind

* ci(k8s): correct cluster name

* test(scorecard): use role instead of clusterrole for oauth rules

* test(scorecard): parse health response for additional checks

* chore(scorecard): add missing newline in logs

* chore(scorecard): check status code before parsing body in health check

* test(scorecard): add custom target discovery to recording scorecard test

* add EOF wait and resp headers

* add resp headers

* chore(client): configure all clients to send safe requests

* fix(clients): add missing content-type header

* fix(scorecard): add missing test name in help message

* chore(client): create new http requests when retrying

* chore(bundle): update scorecard image tags

---------

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>
Co-authored-by: Ming Yu Wang <90855268+mwangggg@users.noreply.github.com>
Co-authored-by: Ming Wang <miwan@redhat.com>

* test(scorecard): scorecard test for Cryostat CR configuration changes (cryostatio#739)

* CR config scorecard

* reformat

* reviews

* add kubectl license

* test(scorecard): scorecard test for report generator  (cryostatio#753)

* deploy reports sidecar

* report scorecard test

* update

* rebase fix

* query health

* fix(build-ci): fix scorecard image tag returned as null (cryostatio#760)

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>
Co-authored-by: Elliott Baron <ebaron@redhat.com>

* test(scorecard): add container logs to scorecard results (cryostatio#758)

* test(scorecard): add container logs to scorecard results

* build(bundle): regenerate bundle with new scorecard tags

* chore(scorecard): refactor to remove duplicate codes

* add permission to publish comment when ci fails (cryostatio#769)

Co-authored-by: Elliott Baron <ebaron@redhat.com>

* Update NewCoreContainer and associated tests

* build(go): update Golang to 1.21 (cryostatio#777)

* test(scorecard): logWorkloadEvent for cryostat-recording errors (cryostatio#759)

* logWorkLoadEvent for cryostat-recording errors

* reviews

* tr.LogChannel

---------

Co-authored-by: Elliott Baron <ebaron@redhat.com>

* test(scorecard): fix rebasing skipped commit (cryostatio#780)

* Merge pull request #8 from ebaron/scorecard-methods

test(scorecard): use methods for more easily passing data

* update bundle image

* Review fixes

* generate storage key, create expected Secret

* fixup! generate storage key, create expected Secret

* database secret handling corrections

* combine database connection password and encryption key into one secret

* correct storage secret key/access key

* update datasource port number to not conflict with storage

* precreate eventtemplates bucket

* remove storage volume parameter overrides

* use HTTP for Cryostat probe even when TLS is enabled - TLS will be done via auth proxy later

* correct environment variable names for proxy awareness

* Fix remaining merge conflict

* Fix makefile

* config cleanup and test fixup

---------

Signed-off-by: Thuan Vo <thuan.votann@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Thuan Vo <thuan.votann@gmail.com>
Co-authored-by: Andrew Azores <aazores@redhat.com>
Co-authored-by: Ming Yu Wang <90855268+mwangggg@users.noreply.github.com>
Co-authored-by: Ming Wang <miwan@redhat.com>
Co-authored-by: Elliott Baron <ebaron@redhat.com>
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

Successfully merging this pull request may close these issues.

4 participants