build: improve error messages for docker driver
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,9 @@ var buildTests = []func(t *testing.T, sb integration.Sandbox){
|
||||
testBuildMobyFromLocalImage,
|
||||
testBuildDetailsLink,
|
||||
testBuildProgress,
|
||||
testBuildCacheExportNotSupported,
|
||||
testBuildOCIExportNotSupported,
|
||||
testBuildMultiPlatformNotSupported,
|
||||
}
|
||||
|
||||
func testBuild(t *testing.T, sb integration.Sandbox) {
|
||||
@@ -313,3 +316,39 @@ func testBuildProgress(t *testing.T, sb integration.Sandbox) {
|
||||
require.Contains(t, string(plainOutput), "[internal] load build definition from Dockerfile")
|
||||
require.Contains(t, string(plainOutput), "[base 1/3] FROM docker.io/library/busybox:latest")
|
||||
}
|
||||
|
||||
func testBuildCacheExportNotSupported(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
dir := createTestProject(t)
|
||||
cmd := buildxCmd(sb, withArgs("build", "--cache-to=type=registry", dir))
|
||||
out, err := cmd.CombinedOutput()
|
||||
require.Error(t, err, string(out))
|
||||
require.Contains(t, string(out), "Cache export is not supported")
|
||||
}
|
||||
|
||||
func testBuildOCIExportNotSupported(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
dir := createTestProject(t)
|
||||
cmd := buildxCmd(sb, withArgs("build", fmt.Sprintf("--output=type=oci,dest=%s/result", dir), dir))
|
||||
out, err := cmd.CombinedOutput()
|
||||
require.Error(t, err, string(out))
|
||||
require.Contains(t, string(out), "OCI exporter is not supported")
|
||||
}
|
||||
|
||||
func testBuildMultiPlatformNotSupported(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
dir := createTestProject(t)
|
||||
cmd := buildxCmd(sb, withArgs("build", "--platform=linux/amd64,linux/arm64", dir))
|
||||
out, err := cmd.CombinedOutput()
|
||||
require.Error(t, err, string(out))
|
||||
require.Contains(t, string(out), "Multi-platform build is not supported")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user