Add some tests for bundlefile and improve the error messages for LoadFile

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c0ea589c1b27f8b68e84cfe6692a7639da52ce6d
Component: engine
This commit is contained in:
Daniel Nephin
2016-06-16 17:55:50 -04:00
parent 64bc8958f7
commit b2b2e47716
6 changed files with 174 additions and 55 deletions

View File

@ -31,7 +31,12 @@ func loadBundlefile(stderr io.Writer, namespace string, path string) (*bundlefil
}
fmt.Fprintf(stderr, "Loading bundle from %s\n", path)
bundle, err := bundlefile.LoadFile(path)
reader, err := os.Open(path)
if err != nil {
return nil, err
}
bundle, err := bundlefile.LoadFile(reader)
if err != nil {
return nil, fmt.Errorf("Error reading %s: %v\n", path, err)
}