Commit the rwLayer to get the correct DiffID Refacator copy in thebuilder move more code into exportImage cleanup some windows tests Release the newly commited layer. Set the imageID on the buildStage after exporting a new image. Move archiver to BuildManager. Have ReleaseableLayer.Commit return a layer and store the Image from exportImage in the local imageSources cache Remove NewChild from image interface. Signed-off-by: Daniel Nephin <dnephin@docker.com> Upstream-commit: 51360965206b0db49cc0365dabb590063a17a9df Component: engine
46 lines
916 B
Go
46 lines
916 B
Go
package dockerfile
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/pkg/testutil/tempfile"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsExistingDirectory(t *testing.T) {
|
|
tmpfile := tempfile.NewTempFile(t, "file-exists-test", "something")
|
|
defer tmpfile.Remove()
|
|
tmpdir := tempfile.NewTempDir(t, "dir-exists-test")
|
|
defer tmpdir.Remove()
|
|
|
|
var testcases = []struct {
|
|
doc string
|
|
path string
|
|
expected bool
|
|
}{
|
|
{
|
|
doc: "directory exists",
|
|
path: tmpdir.Path,
|
|
expected: true,
|
|
},
|
|
{
|
|
doc: "path doesn't exist",
|
|
path: "/bogus/path/does/not/exist",
|
|
expected: false,
|
|
},
|
|
{
|
|
doc: "file exists",
|
|
path: tmpfile.Name(),
|
|
expected: false,
|
|
},
|
|
}
|
|
|
|
for _, testcase := range testcases {
|
|
result, err := isExistingDirectory(testcase.path)
|
|
if !assert.NoError(t, err) {
|
|
continue
|
|
}
|
|
assert.Equal(t, testcase.expected, result, testcase.doc)
|
|
}
|
|
}
|