diff options
author | Vincent Batts <vbatts@redhat.com> | 2015-10-01 12:07:30 -0400 |
---|---|---|
committer | Vincent Batts <vbatts@redhat.com> | 2015-10-01 14:38:55 -0400 |
commit | e4478caddf78700bd42f94eb382ae1805a443618 (patch) | |
tree | b164dd58e78edeecd1fcf70755b87dc05abdf03c /integration-cli/docker_cli_save_load_test.go | |
parent | 7795b1c6979c1da3f05e995e15a966c969d6895f (diff) | |
download | docker-e4478caddf78700bd42f94eb382ae1805a443618.tar.gz |
save: integration test for timestamp matching
The `docker save`ed output ought to have matching timestamp to the layer
creation.
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Diffstat (limited to 'integration-cli/docker_cli_save_load_test.go')
-rw-r--r-- | integration-cli/docker_cli_save_load_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_save_load_test.go b/integration-cli/docker_cli_save_load_test.go index bed9b1cd2d..bb758b6cb6 100644 --- a/integration-cli/docker_cli_save_load_test.go +++ b/integration-cli/docker_cli_save_load_test.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" "io/ioutil" "os" @@ -9,6 +10,7 @@ import ( "reflect" "sort" "strings" + "time" "github.com/go-check/check" ) @@ -94,6 +96,24 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) { } } +func (s *DockerSuite) TestSaveCheckTimes(c *check.C) { + repoName := "busybox:latest" + out, _ := dockerCmd(c, "inspect", repoName) + data := []struct { + ID string + Created time.Time + }{} + err := json.Unmarshal([]byte(out), &data) + c.Assert(err, check.IsNil, check.Commentf("failed to marshal from %q: err %v", repoName, err)) + c.Assert(len(data), check.Not(check.Equals), 0, check.Commentf("failed to marshal the data from %q", repoName)) + tarTvTimeFormat := "2006-01-02 15:04" + out, _, err = runCommandPipelineWithOutput( + exec.Command(dockerBinary, "save", repoName), + exec.Command("tar", "tv"), + exec.Command("grep", "-E", fmt.Sprintf("%s %s", data[0].Created.Format(tarTvTimeFormat), data[0].ID))) + c.Assert(err, check.IsNil, check.Commentf("failed to save repo with image ID and 'repositories' file: %s, %v", out, err)) +} + func (s *DockerSuite) TestSaveImageId(c *check.C) { repoName := "foobar-save-image-id-test" dockerCmd(c, "tag", "emptyfs:latest", fmt.Sprintf("%v:latest", repoName)) |