Skip to content

Commit 3452c4a

Browse files
author
Thean Lim
committed
Migrate ecsacs.Task's Attachments
1 parent 0a51a28 commit 3452c4a

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

agent/acs/session/payload_responder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ func TestHandlePayloadMessageAddedEBSToTask(t *testing.T) {
695695
},
696696
},
697697
},
698-
Attachments: []*acstypes.Attachment{
698+
Attachments: []acstypes.Attachment{
699699
{
700700
AttachmentArn: aws.String("attachmentArn"),
701701
AttachmentProperties: []acstypes.AttachmentProperty{

agent/api/task/task_attachment_handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ func handleTaskAttachments(acsTask *ecsacs.Task, task *Task) error {
8282
var serviceConnectAttachment *acstypes.Attachment
8383
var ebsVolumeAttachments []*acstypes.Attachment
8484
for _, attachment := range acsTask.Attachments {
85+
attachmentPtr:= &attachment
8586
switch aws.ToString(attachment.AttachmentType) {
8687
case serviceConnectAttachmentType:
87-
serviceConnectAttachment = attachment
88+
serviceConnectAttachment = attachmentPtr
8889
case apiresource.EBSTaskAttach:
89-
ebsVolumeAttachments = append(ebsVolumeAttachments, attachment)
90+
ebsVolumeAttachments = append(ebsVolumeAttachments, attachmentPtr)
9091
default:
9192
logger.Debug("Received an attachment type", logger.Fields{
9293
"attachmentType": attachment.AttachmentType,

agent/api/task/task_attachment_handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func TestHandleTaskAttachmentsWithServiceConnectAttachment(t *testing.T) {
164164
Containers: []*ecsacs.Container{
165165
getTestcontainerFromACS(testSCContainerName, AWSVPCNetworkMode),
166166
},
167-
Attachments: []*acstypes.Attachment{
167+
Attachments: []acstypes.Attachment{
168168
{
169169
AttachmentArn: stringToPointer("attachmentArn"),
170170
AttachmentProperties: []acstypes.AttachmentProperty{
@@ -244,7 +244,7 @@ func TestHandleTaskAttachmentWithEBSVolumeAttachment(t *testing.T) {
244244
Containers: []*ecsacs.Container{
245245
getTestcontainerFromACS(testSCContainerName, AWSVPCNetworkMode),
246246
},
247-
Attachments: []*acstypes.Attachment{
247+
Attachments: []acstypes.Attachment{
248248
{
249249
AttachmentArn: stringToPointer("attachmentArn"),
250250
AttachmentProperties: []acstypes.AttachmentProperty{

agent/api/task/task_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4676,7 +4676,7 @@ func TestTaskServiceConnectAttachment(t *testing.T) {
46764676
containerFromACS("C1", 33333, 0, tc.testNetworkMode),
46774677
containerFromACS(serviceConnectContainerTestName, 0, 0, tc.testNetworkMode),
46784678
},
4679-
Attachments: []*acstypes.Attachment{
4679+
Attachments: []acstypes.Attachment{
46804680
{
46814681
AttachmentArn: strptr("attachmentArn"),
46824682
AttachmentProperties: []acstypes.AttachmentProperty{
@@ -4749,7 +4749,7 @@ func TestTaskWithEBSVolumeAttachment(t *testing.T) {
47494749
},
47504750
},
47514751
},
4752-
Attachments: []*acstypes.Attachment{
4752+
Attachments: []acstypes.Attachment{
47534753
{
47544754
AttachmentArn: strptr("attachmentArn"),
47554755
AttachmentProperties: []acstypes.AttachmentProperty{

0 commit comments

Comments
 (0)