Skip to content

Commit 3364acd

Browse files
committed
fix lint error check in controller and recorder body bytes in tests
1 parent 8f6f011 commit 3364acd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

internal/controller/controller.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ func (controller *Controller) NewDecomposer() decomposer.IDecomposer {
7878
// NOTE: Enrolling mainCache by default as reporter
7979
reporter := reporter.New([]downstreamReporter.IDownStreamReporter{})
8080
downstreamReporters := []downstreamReporter.IDownStreamReporter{mainCache}
81-
reporter.RegisterReporters(downstreamReporters)
81+
err := reporter.RegisterReporters(downstreamReporters)
82+
if err != nil {
83+
log.Error("could not load main Cache as reporter for decomposer and executors")
84+
}
8285

8386
actionExecutor := action.New(capabilities, reporter)
8487
playbookActionExecutor := playbook_action.New(controller, controller, reporter)

test/integration/api/reporter_api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func TestGetExecutionReport(t *testing.T) {
278278
app.ServeHTTP(recorder, request)
279279

280280
receivedData := api_model.PlaybookExecutionReport{}
281-
err = json.Unmarshal([]byte(recorder.Body.String()), &receivedData)
281+
err = json.Unmarshal(recorder.Body.Bytes(), &receivedData)
282282
if err != nil {
283283
t.Log(err)
284284
t.Log("Could not parse data to JSON")

test/unittest/routes/reporter_api/reporter_api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestGetExecutionReportInvocation(t *testing.T) {
130130
}
131131

132132
receivedData := api_model.PlaybookExecutionReport{}
133-
err = json.Unmarshal([]byte(recorder.Body.String()), &receivedData)
133+
err = json.Unmarshal(recorder.Body.Bytes(), &receivedData)
134134
if err != nil {
135135
t.Log(err)
136136
t.Log("Could not parse data to JSON")

0 commit comments

Comments
 (0)