Made calling changelog before run return empty. Fixes #1705.

Upstream-commit: 46c9c5c84317907153f06284dc5110b53a0fbf3c
Component: engine
This commit is contained in:
Brian Olsen
2013-08-30 22:46:07 +02:00
parent 8468ddcf8f
commit 77d05d40bc
2 changed files with 11 additions and 2 deletions
+1 -1
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
+10 -1
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)
}