Skip to content

Commit

Permalink
fix: check err
Browse files Browse the repository at this point in the history
  • Loading branch information
wafuwafu13 committed Apr 22, 2023
1 parent f9ac9df commit a07d554
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions events/ecs_container_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
// `registeredResources` key and `remainingResources` key have `stringSetValue` key.
// if `stringSetValue` key is empty array, it should be removed from outputJSON.
var result map[string]interface{}
json.Unmarshal(outputJSON, &result)
err = json.Unmarshal(outputJSON, &result)
if err != nil {
t.Errorf("could not marshal event. details: %v", err)
}
for _, resourcesType := range []string{"registeredResources", "remainingResources"} {
resources := result["detail"].(map[string]interface{})[resourcesType].([]interface{})
for i, resource := range resources {
Expand All @@ -99,7 +102,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
}
}
}
resultJSON, _ := json.Marshal(result)
resultJSON, err := json.Marshal(result)
if err != nil {
t.Errorf("could not marshal event. details: %v", err)
}

assert.JSONEq(t, string(outputJSON), string(resultJSON))
}
Expand Down

0 comments on commit a07d554

Please sign in to comment.