Skip to content

Commit d1d87e2

Browse files
Thean LimTheanLim
authored andcommitted
Fix: misc type fixes
1 parent 080d85d commit d1d87e2

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

agent/api/task/task_windows_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestPostUnmarshalWindowsCanonicalPaths(t *testing.T) {
7676
Volumes: []acstypes.Volume{
7777
{
7878
Name: strptr("sourceVolume"),
79-
Type: strptr("host"),
79+
Type: "host",
8080
Host: &acstypes.HostVolumeProperties{
8181
SourcePath: strptr(`C:/Host/path`),
8282
},
@@ -112,7 +112,7 @@ func TestPostUnmarshalWindowsCanonicalPaths(t *testing.T) {
112112
},
113113
}
114114

115-
seqNum := int64(42)
115+
seqNum := int32(42)
116116
task, err := TaskFromACS(&taskFromAcs, &acs.PayloadInput{SeqNum: &seqNum})
117117
assert.Nil(t, err, "Should be able to handle acs task")
118118
cfg := config.Config{TaskCPUMemLimit: config.BooleanDefaultTrue{Value: config.ExplicitlyDisabled}}
@@ -498,7 +498,7 @@ func TestPostUnmarshalTaskWithFSxWindowsFileServerVolumes(t *testing.T) {
498498
Volumes: []acstypes.Volume{
499499
{
500500
Name: strptr("fsxWindowsFileServerVolume"),
501-
Type: strptr("fsxWindowsFileServer"),
501+
Type: "fsxWindowsFileServer",
502502
FsxWindowsFileServerVolumeConfiguration: &acstypes.FSxWindowsFileServerVolumeConfiguration{
503503
AuthorizationConfig: &acstypes.FSxWindowsFileServerAuthorizationConfig{
504504
CredentialsParameter: strptr("arn"),

ecs-agent/netlib/network_builder_windows_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
mock_netwrapper "github.com/aws/amazon-ecs-agent/ecs-agent/utils/netwrapper/mocks"
2828

2929
"github.com/aws/aws-sdk-go-v2/aws"
30-
"github.com/aws/aws-sdk-go-v2/service/acs"
30+
acstypes "github.com/aws/aws-sdk-go-v2/service/acs/types"
3131
"github.com/golang/mock/gomock"
3232
"github.com/stretchr/testify/require"
3333
)
@@ -39,7 +39,7 @@ func TestNetworkBuilder_BuildTaskNetworkConfiguration(t *testing.T) {
3939
// getTestFunc returns a test function that verifies the capability of the networkBuilder
4040
// to translate a given input task payload into desired network data models.
4141
func getTestFunc(
42-
dataGenF func(string) (input *acs.Task, expected tasknetworkconfig.TaskNetworkConfig),
42+
dataGenF func(string) (input *acstypes.Task, expected tasknetworkconfig.TaskNetworkConfig),
4343
plt string,
4444
) func(*testing.T) {
4545

@@ -65,7 +65,7 @@ func getTestFunc(
6565
var ifaces []net.Interface
6666
idx := 1
6767
for _, eni := range taskPayload.ElasticNetworkInterfaces {
68-
mac := aws.StringValue(eni.MacAddress)
68+
mac := aws.ToString(eni.MacAddress)
6969
hw, err := net.ParseMAC(mac)
7070
require.NoError(t, err)
7171
ifaces = append(ifaces, net.Interface{

ecs-agent/netlib/platform/containerd_windows.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ func (c *containerd) buildAWSVPCNetworkConfig(
105105
}
106106

107107
// Find primary network interface in order to build the task netns name.
108-
var primaryIF *acstypes.ElasticNetworkInterface
108+
var primaryIF acstypes.ElasticNetworkInterface
109109
for _, eni := range taskPayload.ElasticNetworkInterfaces {
110-
if aws.ToInt64(eni.Index) == 0 {
110+
if aws.ToInt32(eni.Index) == 0 {
111111
primaryIF = eni
112112
}
113113
}
114-
ifName := networkinterface.GetInterfaceName(primaryIF)
114+
ifName := networkinterface.GetInterfaceName(&primaryIF)
115115
netNSName := networkinterface.NetNSName(taskID, ifName)
116116
netNSPath := c.GetNetNSPath(netNSName)
117117

@@ -128,11 +128,15 @@ func (c *containerd) buildAWSVPCNetworkConfig(
128128
"MacToNames": macToNames,
129129
})
130130

131+
eniPointerSlice := make([]*acstypes.ElasticNetworkInterface, len(taskPayload.ElasticNetworkInterfaces))
132+
for i := range taskPayload.ElasticNetworkInterfaces {
133+
eniPointerSlice[i] = &taskPayload.ElasticNetworkInterfaces[i]
134+
}
131135
// Create interface object.
132136
iface, err := networkinterface.New(
133-
taskPayload.ElasticNetworkInterfaces[0],
137+
&taskPayload.ElasticNetworkInterfaces[0],
134138
"",
135-
taskPayload.ElasticNetworkInterfaces,
139+
eniPointerSlice,
136140
macToNames,
137141
)
138142
iface.Default = true

0 commit comments

Comments
 (0)