-
Notifications
You must be signed in to change notification settings - Fork 949
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
test: add test for different volume sources #1553
test: add test for different volume sources #1553
Conversation
fdf0d97
to
27f0e6b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1553 +/- ##
==========================================
- Coverage 41.3% 39.98% -1.33%
==========================================
Files 267 267
Lines 17331 17975 +644
==========================================
+ Hits 7159 7187 +28
- Misses 9282 9898 +616
Partials 890 890
|
test/cli_run_volume_test.go
Outdated
DelContainerForceMultyTime(c, containerName1) | ||
DelContainerForceMultyTime(c, containerName2) | ||
RemoveVolume(c, volumeName1) | ||
command.PouchRun("rmi", "-f", imageWithVolume).Assert(c, icmd.Success) |
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.
For the cleanup code, please use defer
and put them in the right place.
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.
@Letty5411 The volume must be deleted after all containers has been deleted
but the volume name is generated after run container, So if I want to use defer, the logic is:
pull image
defer rm image
run container1
run container2
getVolumeName
defer rm volume
defer rm container1
defer rm container2
I think it's ugly. So I don't use defer
test/cli_run_volume_test.go
Outdated
@@ -170,6 +172,53 @@ func (suite *PouchRunVolumeSuite) TestRunWithVolumesFromWithDupclicate(c *check. | |||
c.Assert(volumeFound, check.Equals, true) | |||
} | |||
|
|||
func (suite *PouchRunVolumeSuite) TestRunWithVolumesFromDifferentSources(c *check.C) { | |||
imageWithVolume := "registry.hub.docker.com/shaloulcy/busybox:with-volume" |
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 add a todo
here, we'd better build image explicitly when build
CMD is supported in pouch.
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.
fine
the volumes of container have four different sources(volumes-from, binds, images and Config.Volume). If two volumes have the same destination, only one volume is reserved. The order is volumes-from > binds > images > Config.Volume Signed-off-by: Eric Li <[email protected]>
27f0e6b
to
1198581
Compare
@Letty5411 I have updated the code, PTAL |
LGTM |
the volumes of container have four different sources(volumes-from,
binds, images and Config.Volume). If two volumes have the same destination,
only one volume is reserved. The order is
volumes-from > binds > images > Config.Volume
Signed-off-by: Eric Li [email protected]
Ⅰ. Describe what this PR did
the volumes of container have four different sources(volumes-from, binds, images and Config.Volume). If two volumes have the same destination, only one volume is reserved. The order is
volumes-from > binds > images > Config.Volume
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
NONE
Ⅳ. Describe how to verify it
NONE
Ⅴ. Special notes for reviews