Skip to content

Commit

Permalink
fix: []*string -> []string
Browse files Browse the repository at this point in the history
  • Loading branch information
wafuwafu13 committed Apr 22, 2023
1 parent 8dbfe7b commit 7316ef1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions events/ecs_container_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type ECSContainerInstanceEventAttribute struct {
}

type ECSContainerInstanceEventResource struct {
Name string `json:"name"`
Type string `json:"type"`
IntegerValue int `json:"integerValue,omitempty"`
StringSetValue []*string `json:"stringSetValue,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
IntegerValue int `json:"integerValue,omitempty"`
StringSetValue []string `json:"stringSetValue,omitempty"`
}

type ECSContainerInstanceEventVersionInfo struct {
Expand Down
12 changes: 4 additions & 8 deletions events/ecs_container_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
assert.Equal(t, 3767, detail.RegisteredResources[1].IntegerValue)
assert.Equal(t, "PORTS", detail.RegisteredResources[2].Name)
assert.Equal(t, "STRINGSET", detail.RegisteredResources[2].Type)
assert.Equal(t, []*string{ptr("22"), ptr("2376"), ptr("2375"), ptr("51678"), ptr("51679")}, detail.RegisteredResources[2].StringSetValue)
assert.Equal(t, []string{"22", "2376", "2375", "51678", "51679"}, detail.RegisteredResources[2].StringSetValue)
assert.Equal(t, "PORTS_UDP", detail.RegisteredResources[3].Name)
assert.Equal(t, "STRINGSET", detail.RegisteredResources[3].Type)
assert.Equal(t, []*string{}, detail.RegisteredResources[3].StringSetValue)
assert.Equal(t, []string{}, detail.RegisteredResources[3].StringSetValue)
assert.Equal(t, "CPU", detail.RemainingResources[0].Name)
assert.Equal(t, "INTEGER", detail.RemainingResources[0].Type)
assert.Equal(t, 1988, detail.RemainingResources[0].IntegerValue)
Expand All @@ -60,10 +60,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
assert.Equal(t, 767, detail.RemainingResources[1].IntegerValue)
assert.Equal(t, "PORTS", detail.RemainingResources[2].Name)
assert.Equal(t, "STRINGSET", detail.RemainingResources[2].Type)
assert.Equal(t, []*string{ptr("22"), ptr("2376"), ptr("2375"), ptr("51678"), ptr("51679")}, detail.RemainingResources[2].StringSetValue)
assert.Equal(t, []string{"22", "2376", "2375", "51678", "51679"}, detail.RemainingResources[2].StringSetValue)
assert.Equal(t, "PORTS_UDP", detail.RemainingResources[3].Name)
assert.Equal(t, "STRINGSET", detail.RemainingResources[3].Type)
assert.Equal(t, []*string{}, detail.RemainingResources[3].StringSetValue)
assert.Equal(t, []string{}, detail.RemainingResources[3].StringSetValue)
assert.Equal(t, "ACTIVE", detail.Status)
assert.Equal(t, 14801, detail.Version)
assert.Equal(t, "aebcbca", detail.VersionInfo.AgentHash)
Expand All @@ -85,10 +85,6 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) {
assert.JSONEq(t, string(inputJSON), string(outputJSON))
}

func ptr(s string) *string {
return &s
}

func TestECSContainerInstanceMarshalingMalformedJson(t *testing.T) {
test.TestMalformedJson(t, ECSContainerInstanceEvent{})
}

0 comments on commit 7316ef1

Please sign in to comment.