-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: split packages #85
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #85 +/- ##
===========================================
+ Coverage 74.36% 88.35% +13.99%
===========================================
Files 18 21 +3
Lines 987 1065 +78
===========================================
+ Hits 734 941 +207
+ Misses 145 61 -84
+ Partials 108 63 -45 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my review, I've only noted one point. The changes have made the errors and process more understandable. The adoption of dependency injection has contributed to streamlining the code. Nice work!
env/env.go
Outdated
if noSvc != nil || noTd != nil { | ||
return nil, nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json' or 'task-definition.json'", dir) | ||
if noSvc != nil { | ||
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json' or 'task-definition.json'", dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to update the error messages in the LoadServiceDefinition
and LoadTaskDefinition
functions to specify the corresponding missing files.
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json' or 'task-definition.json'", dir) | |
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json'", dir) |
env/env.go
Outdated
_, noTd := os.Stat(tdPath) | ||
var td ecs.RegisterTaskDefinitionInput | ||
if noTd != nil { | ||
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json' or 'task-definition.json'", dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'service.json' or 'task-definition.json'", dir) | |
return nil, xerrors.Errorf("roll out context specified at '%s' but no 'task-definition.json'", dir) |
} else if err := canaryTasks.Cleanup(ctx); err != nil { | ||
log.Errorf("failed to cleanup canary tasks due to: %s", err) | ||
lastErr = err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR includes various changes across the package. Mainly, the most part of
cage
were split into sub packages for unit test convenience.task
: codes for canary test, both ALB test and simple wait testtaskset
: an abstraction of combined tasks for single servicerollout
: a core logic part ofcage rollout
types
: common interfacesenv
: environment variableslogos/di introduction
We are now using logos/di for dependency management.
Rewritten tests
Almost all tests have been rewritten, based on the policy below:
test
pacgaestest
package and failure tests with gomock forcage
packageNow, I chose the same package for unit test codes not
_test
: to simulate failures that depends on internal stateOther changes
cage
commands skip loading task definition file if--taskDefinitionArn
opt provided.--canaryIdleDuration
changed to 15 seconds.ElasticNetworkInterface