-
Notifications
You must be signed in to change notification settings - Fork 950
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: encapsulate codes into function FormatStatus #542
refactor: encapsulate codes into function FormatStatus #542
Conversation
Thanks a lot for your work. 🌹 |
daemon/mgr/container_types.go
Outdated
var status string | ||
|
||
if meta.State.Status == types.StatusRunning || meta.State.Status == types.StatusPaused { | ||
start, _ := time.Parse(utils.TimeLayout, meta.State.StartedAt) |
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.
Please do not ignore this error.
Codecov Report
@@ Coverage Diff @@
## master #542 +/- ##
==========================================
+ Coverage 14.24% 14.49% +0.25%
==========================================
Files 64 64
Lines 3159 3173 +14
==========================================
+ Hits 450 460 +10
- Misses 2664 2666 +2
- Partials 45 47 +2
Continue to review full report at Codecov.
|
Should I add unit test in utils_test.go or somewhere? @allencloud |
In |
Signed-off-by: zeppp <[email protected]>
50b9718
to
4498efa
Compare
apis/server/container_bridge.go
Outdated
} | ||
} else { | ||
container.Status = string(m.State.Status) | ||
status, err := m.FormatStatus() |
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.
Move this part above above container := types.Container{
and still in the for loop, then we can add status when constructing the instance, like:
container := types.Container{
ID: m.ID,
Names: []string{m.Name},
Image: m.Config.Image,
Command: strings.Join(m.Config.Cmd, " "),
Created: t.UnixNano(),
Labels: m.Config.Labels,
HostConfig: m.HostConfig,
Status: status,
}
Signed-off-by: zeppp <[email protected]>
4498efa
to
e32c190
Compare
LGTM, much better now. |
Signed-off-by: zeppp [email protected]
1.Describe what this PR did
encapsulate codes into function FormatStatus
2.Does this pull request fix one issue?
3.Describe how you did it
4.Describe how to verify it
5.Special notes for reviews