Skip to content

Commit

Permalink
fix exitCode type
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyili committed May 21, 2024
1 parent 5e64aaa commit 6accf85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
9 changes: 7 additions & 2 deletions pkg/util/ecs/metadata/v3or4/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ var expected = &Task{
StartedAt: "2023-11-20T12:10:44.404563253Z",
Type: "NORMAL",
Health: &HealthStatus{
Status: "HEALTHY",
Since: "2023-11-20T12:11:16.383262018Z",
Status: "HEALTHY",
Since: "2023-11-20T12:11:16.383262018Z",
ExitCode: toPointer(-1),
},
Volumes: []Volume{
{
Expand All @@ -126,3 +127,7 @@ var expected = &Task{
},
},
}

func toPointer[T any](v T) *T {
return &v
}
3 changes: 2 additions & 1 deletion pkg/util/ecs/metadata/v3or4/testdata/task_with_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"Type": "NORMAL",
"Health": {
"status": "HEALTHY",
"statusSince": "2023-11-20T12:11:16.383262018Z"
"statusSince": "2023-11-20T12:11:16.383262018Z",
"exitCode": -1
},
"Volumes": [
{
Expand Down
10 changes: 5 additions & 5 deletions pkg/util/ecs/metadata/v3or4/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ type Container struct {
ContainerARN string `json:"ContainerARN,omitempty"` // present only in v4
Health *HealthStatus `json:"Health,omitempty"`
Volumes []Volume `json:"Volumes,omitempty"`
ExitCode *uint32 `json:"ExitCode,omitempty"`
ExitCode *int `json:"ExitCode,omitempty"`
Snapshotter string `json:"Snapshotter,omitempty"`
}

// HealthStatus represents the health status of a container
type HealthStatus struct {
Status string `json:"status,omitempty"`
Since string `json:"statusSince,omitempty"`
ExitCode *uint32 `json:"exitCode,omitempty"`
Output string `json:"output,omitempty"`
Status string `json:"status,omitempty"`
Since string `json:"statusSince,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
Output string `json:"output,omitempty"`
}

// Network represents the network of a container
Expand Down

0 comments on commit 6accf85

Please sign in to comment.