Skip to content

Commit

Permalink
fix lint error check in controller and recorder body bytes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamrgs authored and RabbITCybErSeC committed May 8, 2024
1 parent a9b47f8 commit df53e97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ func (controller *Controller) NewDecomposer() decomposer.IDecomposer {
// NOTE: Enrolling mainCache by default as reporter
reporter := reporter.New([]downstreamReporter.IDownStreamReporter{})
downstreamReporters := []downstreamReporter.IDownStreamReporter{mainCache}
reporter.RegisterReporters(downstreamReporters)
err := reporter.RegisterReporters(downstreamReporters)
if err != nil {
log.Error("could not load main Cache as reporter for decomposer and executors")
}

actionExecutor := action.New(capabilities, reporter)
playbookActionExecutor := playbook_action.New(controller, controller, reporter)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/api/reporter_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestGetExecutionReport(t *testing.T) {
app.ServeHTTP(recorder, request)

receivedData := api_model.PlaybookExecutionReport{}
err = json.Unmarshal([]byte(recorder.Body.String()), &receivedData)
err = json.Unmarshal(recorder.Body.Bytes(), &receivedData)
if err != nil {
t.Log(err)
t.Log("Could not parse data to JSON")
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/routes/reporter_api/reporter_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func TestGetExecutionReportInvocation(t *testing.T) {
}

receivedData := api_model.PlaybookExecutionReport{}
err = json.Unmarshal([]byte(recorder.Body.String()), &receivedData)
err = json.Unmarshal(recorder.Body.Bytes(), &receivedData)
if err != nil {
t.Log(err)
t.Log("Could not parse data to JSON")
Expand Down

0 comments on commit df53e97

Please sign in to comment.