mirror of https://github.com/docker/docs.git
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:
commit
d9b7ec6458
|
@ -99,7 +99,7 @@ func Changes(layers []string, rw string) ([]Change, error) {
|
||||||
changes = append(changes, change)
|
changes = append(changes, change)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return changes, nil
|
return changes, nil
|
||||||
|
|
|
@ -138,12 +138,21 @@ func TestDiff(t *testing.T) {
|
||||||
container1, _, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t)
|
container1, _, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t)
|
||||||
defer runtime.Destroy(container1)
|
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 {
|
if err := container1.Run(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the changelog
|
// Check the changelog
|
||||||
c, err := container1.Changes()
|
c, err = container1.Changes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue