cryostatio / cryostatio/cryostat-operator

[Bug] Scorecard tests do not exercise long-running/async job API

Open
#986 0 comments 0 reactions 0 assignees View on GitHub
test
Dominant language
Go
Stars
37
Forks
22
Avg merge
21h 37m
Merged PRs (30d)
22

Description

### Current Behavior

Scorecard tests do not have a websocket server connection, so the report generation request (currently the only long-running job request) was adjusted from expecting a full report JSON response to simply expecting an OK status code and a string ID response body.

### Expected Behavior

The scorecard tests should maintain a websocket server connection that can be used to listen for notifications from the server. When testing long-running jobs, like report generation, the scorecards should:

1. Fire the initial request
2. Check the response status code and/or Content-Type header. This will indicate whether the response body should be interpreted as a string job ID, or as a JSON response body, or nothing at all (for jobs which do not produce a response body).
3. If the response was a job ID, the test client should wait for a websocket notification to be emitted which has the expected notification category (ex. report generation) and indicates that the job with the same ID has been completed. Once that notification has been emitted, the client should re-fire the original request.
4. If the response was a JSON response body, the client should check that the body passes whatever assertions the test wants to make.

### Steps To Reproduce

_No response_

### Environment

_No response_

### Anything else?

https://github.com/cryostatio/cryostat-operator/pull/985
https://github.com/cryostatio/cryostat/pull/698
https://github.com/cryostatio/cryostat/issues/286

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the scorecard tests and the report-generation request, then read the linked pull requests and Cryostat issue for context on the websocket behavior. Done means the tests maintain a websocket connection, distinguish job IDs from JSON or empty responses, wait for the matching completion notification, and re-fire the request when needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.