Skip to content

fix: error out if there is no active service#5336

Merged
mergify[bot] merged 2 commits intoaws:mainlinefrom
Lou1415926:fix/panic/no/active/service
Sep 27, 2023
Merged

fix: error out if there is no active service#5336
mergify[bot] merged 2 commits intoaws:mainlinefrom
Lou1415926:fix/panic/no/active/service

Conversation

@Lou1415926
Copy link
Copy Markdown
Contributor

@Lou1415926 Lou1415926 commented Sep 27, 2023

Otherwise panic when accessing activeSvc[0].

I think erroring out makes sense here, because this is basically the same scenario as when "resourceGroupAPI" returns nothing given the tags:

services, err := c.rgGetter.GetResourcesByTags(serviceResourceType, tags)
if err != nil {
  return nil, fmt.Errorf("get ECS service with tags %s: %w", tags.String(), err)
}
if len(services) == 0 {
  return nil, fmt.Errorf("no ECS service found with tags %s", tags.String())
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@Lou1415926 Lou1415926 requested a review from a team as a code owner September 27, 2023 23:00
@Lou1415926 Lou1415926 requested review from efekarakus and removed request for a team September 27, 2023 23:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Sep 27, 2023

🍕 Here are the new binary sizes!

Name New size (kiB) size (kiB) Delta (%)
macOS (amd) 51892 51740 +0.29
macOS (arm) 52740 52596 +0.27
linux (amd) 45636 45496 +0.31
linux (arm) 44932 44804 +0.29
windows (amd) 43100 42968 +0.31

1 similar comment
@github-actions
Copy link
Copy Markdown

🍕 Here are the new binary sizes!

Name New size (kiB) size (kiB) Delta (%)
macOS (amd) 51892 51740 +0.29
macOS (arm) 52740 52596 +0.27
linux (amd) 45636 45496 +0.31
linux (arm) 44932 44804 +0.29
windows (amd) 43100 42968 +0.31

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5db2bc7) 69.80% compared to head (1fdedf1) 69.80%.

Additional details and impacted files
@@            Coverage Diff            @@
##           mainline    #5336   +/-   ##
=========================================
  Coverage     69.80%   69.80%           
=========================================
  Files           296      296           
  Lines         44758    44761    +3     
  Branches        287      287           
=========================================
+ Hits          31244    31247    +3     
  Misses        11996    11996           
  Partials       1518     1518           
Files Coverage Δ
internal/pkg/ecs/ecs.go 85.41% <100.00%> (+0.13%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mergify mergify Bot merged commit cf98cde into aws:mainline Sep 27, 2023
KollaAdithya pushed a commit to KollaAdithya/copilot-cli that referenced this pull request Oct 18, 2023
Otherwise panic when accessing `activeSvc[0]`.

I think erroring out makes sense here, because this is basically the same scenario as when "resourceGroupAPI" returns nothing given the tags:
```go
services, err := c.rgGetter.GetResourcesByTags(serviceResourceType, tags)
if err != nil {
  return nil, fmt.Errorf("get ECS service with tags %s: %w", tags.String(), err)
}
if len(services) == 0 {
  return nil, fmt.Errorf("no ECS service found with tags %s", tags.String())
}
```

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants