Skip to content

Commit a07d554

Browse files
author
wafuwafu13
committed
fix: check err
1 parent f9ac9df commit a07d554

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

events/ecs_container_instance_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
8585
// `registeredResources` key and `remainingResources` key have `stringSetValue` key.
8686
// if `stringSetValue` key is empty array, it should be removed from outputJSON.
8787
var result map[string]interface{}
88-
json.Unmarshal(outputJSON, &result)
88+
err = json.Unmarshal(outputJSON, &result)
89+
if err != nil {
90+
t.Errorf("could not marshal event. details: %v", err)
91+
}
8992
for _, resourcesType := range []string{"registeredResources", "remainingResources"} {
9093
resources := result["detail"].(map[string]interface{})[resourcesType].([]interface{})
9194
for i, resource := range resources {
@@ -99,7 +102,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
99102
}
100103
}
101104
}
102-
resultJSON, _ := json.Marshal(result)
105+
resultJSON, err := json.Marshal(result)
106+
if err != nil {
107+
t.Errorf("could not marshal event. details: %v", err)
108+
}
103109

104110
assert.JSONEq(t, string(outputJSON), string(resultJSON))
105111
}

0 commit comments

Comments
 (0)