Merge pull request #1754 from griff/1705_changelog_fails_before_run

- Runtime: Made calling change log before run return empty list.
This commit is contained in:
Guillaume J. Charmes 2013-08-30 16:02:46 -07:00
commit d9b7ec6458
2 changed files with 11 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func Changes(layers []string, rw string) ([]Change, error) {
changes = append(changes, change)
return nil
})
if err != nil {
if err != nil && !os.IsNotExist(err) {
return nil, err
}
return changes, nil

View File

@ -138,12 +138,21 @@ func TestDiff(t *testing.T) {
container1, _, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t)
defer runtime.Destroy(container1)
// The changelog should be empty and not fail before run. See #1705
c, err := container1.Changes()
if err != nil {
t.Fatal(err)
}
if len(c) != 0 {
t.Fatalf("Changelog should be empty before run")
}
if err := container1.Run(); err != nil {
t.Fatal(err)
}
// Check the changelog
c, err := container1.Changes()
c, err = container1.Changes()
if err != nil {
t.Fatal(err)
}