@@ -13,7 +13,6 @@ import (
1313 "strings"
1414
1515 "github.com/containers/buildah/define"
16- "github.com/containers/podman/v6/test/utils"
1716 . "github.com/containers/podman/v6/test/utils"
1817 . "github.com/onsi/ginkgo/v2"
1918 . "github.com/onsi/gomega"
@@ -1413,7 +1412,7 @@ COPY --from=img2 /etc/alpine-release /prefix-test/container-prefix.txt`
14131412
14141413 It ("podman build --output -" , func () {
14151414 // Capture output to buffer manually, to avoid binary output leaking into test logs
1416- session := podmanTest .PodmanWithOptions (utils. PodmanExecOptions {
1415+ session := podmanTest .PodmanWithOptions (PodmanExecOptions {
14171416 FullOutputWriter : io .Discard ,
14181417 }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "-" )
14191418 session .WaitWithDefaultTimeout ()
@@ -1425,7 +1424,7 @@ COPY --from=img2 /etc/alpine-release /prefix-test/container-prefix.txt`
14251424
14261425 It ("podman build --output type=tar,dest=-" , func () {
14271426 // Capture output to buffer manually, to avoid binary output leaking into test logs
1428- session := podmanTest .PodmanWithOptions (utils. PodmanExecOptions {
1427+ session := podmanTest .PodmanWithOptions (PodmanExecOptions {
14291428 FullOutputWriter : io .Discard ,
14301429 }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=tar,dest=-" )
14311430 session .WaitWithDefaultTimeout ()
@@ -1435,4 +1434,32 @@ COPY --from=img2 /etc/alpine-release /prefix-test/container-prefix.txt`
14351434 Expect (session .OutputToString ()).To (ContainSubstring ("ustar" ))
14361435 })
14371436
1437+ // Should error because no type
1438+ It ("podman build --output dest=./folder" , func () {
1439+ session := podmanTest .Podman ([]string {"build" , "-f" , "build/basicalpine/Containerfile" , "--output" , fmt .Sprintf ("dest=%v" , podmanTest .TempDir )})
1440+ session .WaitWithDefaultTimeout ()
1441+ Expect (session ).Should (ExitWithError (125 , `missing required key "type"` ))
1442+ })
1443+
1444+ // Should error because invalid type
1445+ It ("podman build --output type=INVALID" , func () {
1446+ session := podmanTest .Podman ([]string {"build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=INVALID" })
1447+ session .WaitWithDefaultTimeout ()
1448+ Expect (session ).Should (ExitWithError (125 , `invalid type "INVALID"` ))
1449+ })
1450+
1451+ // Should error because no dest specified
1452+ It ("podman build --output type=local" , func () {
1453+ session := podmanTest .Podman ([]string {"build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=local" })
1454+ session .WaitWithDefaultTimeout ()
1455+ Expect (session ).Should (ExitWithError (125 , `missing required key "dest"` ))
1456+ })
1457+
1458+ // Should error because invalid dest for local type
1459+ It ("podman build --output type=local,dest=-" , func () {
1460+ session := podmanTest .Podman ([]string {"build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=local,dest=-" })
1461+ session .WaitWithDefaultTimeout ()
1462+ Expect (session ).Should (ExitWithError (125 , `only "type=tar" can be used with "dest=-"` ))
1463+ })
1464+
14381465})
0 commit comments