From a543918e84dd0c2da8fadb79633048aa5fa92f9c Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 17 Dec 2024 16:07:13 -0500 Subject: [PATCH] test(scorecard): adjust scorecard report generation expectation (#985) --- internal/test/scorecard/clients.go | 8 +++----- internal/test/scorecard/tests.go | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/test/scorecard/clients.go b/internal/test/scorecard/clients.go index 7fa5f83df..fd67351ff 100644 --- a/internal/test/scorecard/clients.go +++ b/internal/test/scorecard/clients.go @@ -422,7 +422,7 @@ func (client *RecordingClient) Delete(ctx context.Context, target *Target, recor return nil } -func (client *RecordingClient) GenerateReport(ctx context.Context, target *Target, recording *Recording) (map[string]interface{}, error) { +func (client *RecordingClient) RequestReportGeneration(ctx context.Context, target *Target, recording *Recording) (*string, error) { if len(recording.ReportURL) < 1 { return nil, fmt.Errorf("report URL is not available") } @@ -430,7 +430,6 @@ func (client *RecordingClient) GenerateReport(ctx context.Context, target *Targe reportURL := client.Base.JoinPath(recording.ReportURL) header := make(http.Header) - header.Add("Accept", "application/json") resp, err := SendRequest(ctx, client.Client, http.MethodGet, reportURL.String(), nil, header) if err != nil { @@ -442,13 +441,12 @@ func (client *RecordingClient) GenerateReport(ctx context.Context, target *Targe return nil, fmt.Errorf("API request failed with status code: %d, response body: %s, and headers:\n%s", resp.StatusCode, ReadError(resp), ReadHeader(resp)) } - report := make(map[string]interface{}, 0) - err = ReadJSON(resp, &report) + report, err := ReadString(resp) if err != nil { return nil, fmt.Errorf("failed to read response body: %s", err.Error()) } - return report, nil + return &report, nil } func (client *RecordingClient) ListArchives(ctx context.Context, target *Target) ([]Archive, error) { diff --git a/internal/test/scorecard/tests.go b/internal/test/scorecard/tests.go index 55b90f899..bd287186c 100644 --- a/internal/test/scorecard/tests.go +++ b/internal/test/scorecard/tests.go @@ -226,11 +226,11 @@ func CryostatRecordingTest(bundle *apimanifests.Bundle, namespace string, openSh } r.Log += fmt.Sprintf("current list of archives: %+v\n", archives) - report, err := apiClient.Recordings().GenerateReport(context.Background(), target, rec) + reportJobId, err := apiClient.Recordings().RequestReportGeneration(context.Background(), target, rec) if err != nil { return r.fail(fmt.Sprintf("failed to generate report for the recording: %s", err.Error())) } - r.Log += fmt.Sprintf("generated report for the recording %s: %+v\n", rec.Name, report) + r.Log += fmt.Sprintf("report generation job ID for the recording %s: %+v\n", rec.Name, *reportJobId) // Stop the recording err = apiClient.Recordings().Stop(context.Background(), target, rec.Id)