Skip to content

Commit

Permalink
Merge pull request #1899 from YaoZengzeng/volume-test
Browse files Browse the repository at this point in the history
test: run with volume whose destination is not empty
  • Loading branch information
shaloulcy authored Jul 26, 2018
2 parents e8179b3 + e141b5c commit e42ceba
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/cli_run_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ func (suite *PouchRunVolumeSuite) TestRunWithVolumesFrom(c *check.C) {
c.Assert(volumeFound, check.Equals, true)
}

// TestRunWithVolumesDestinationNotEmpty tests running container with a volume whose
// destination path in the image is not empty, we should populate the volume with
// corresponding content in the image.
func (suite *PouchRunVolumeSuite) TestRunWithVolumesDestinationNotEmpty(c *check.C) {
// The image `calico/cni:v3.1.3` has an anonymous volume whose destination path
// is `/opt/cni` which is not empty in the image. We should still be able to see
// the data in the image's `/opt/cni` when the volume is mounted.
// Details refer to: https://github.com/alibaba/pouch/issues/1739
image := "calico/cni:v3.1.3"
containerName := "volumesDestinationNotEmpty"

// For the workdir of image `calico/cni:v3.1.3` is `/opt/cni/bin`,
// it is enough to prove this feature works fine if we could run
// the container with default workdir successfully.
res := command.PouchRun("run", "--name", containerName, image, "ls")
defer DelContainerForceMultyTime(c, containerName)
res.Assert(c, icmd.Success)
}

// TestRunWithVolumesFromWithDupclicate tests running container with --volumes-from.
func (suite *PouchRunVolumeSuite) TestRunWithVolumesFromWithDupclicate(c *check.C) {
volumeName := "volumesfromDupclicate-test-volume"
Expand Down

0 comments on commit e42ceba

Please sign in to comment.