@@ -1435,4 +1435,44 @@ COPY --from=img2 /etc/alpine-release /prefix-test/container-prefix.txt`
14351435 Expect (session .OutputToString ()).To (ContainSubstring ("ustar" ))
14361436 })
14371437
1438+ // Should error because no type
1439+ FIt ("podman build --output dest=./folder" , func () {
1440+ // Capture output to buffer manually, to avoid binary output leaking into test logs
1441+ session := podmanTest .PodmanWithOptions (utils.PodmanExecOptions {
1442+ FullOutputWriter : io .Discard ,
1443+ }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , fmt .Sprintf ("dest=%v" , podmanTest .TempDir ))
1444+ session .WaitWithDefaultTimeout ()
1445+ Expect (session ).Should (ExitWithError (125 , `missing required key "type"` ))
1446+ })
1447+
1448+ // Should error because invalid type
1449+ FIt ("podman build --output type=INVALID" , func () {
1450+ // Capture output to buffer manually, to avoid binary output leaking into test logs
1451+ session := podmanTest .PodmanWithOptions (utils.PodmanExecOptions {
1452+ FullOutputWriter : io .Discard ,
1453+ }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=INVALID" )
1454+ session .WaitWithDefaultTimeout ()
1455+ Expect (session ).Should (ExitWithError (125 , `invalid type "INVALID"` ))
1456+ })
1457+
1458+ // Should error because no dest specified
1459+ FIt ("podman build --output type=local" , func () {
1460+ // Capture output to buffer manually, to avoid binary output leaking into test logs
1461+ session := podmanTest .PodmanWithOptions (utils.PodmanExecOptions {
1462+ FullOutputWriter : io .Discard ,
1463+ }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=local" )
1464+ session .WaitWithDefaultTimeout ()
1465+ Expect (session ).Should (ExitWithError (125 , `missing required key "dest"` ))
1466+ })
1467+
1468+ // Should error because invalid dest for local type
1469+ FIt ("podman build --output type=local,dest=-" , func () {
1470+ // Capture output to buffer manually, to avoid binary output leaking into test logs
1471+ session := podmanTest .PodmanWithOptions (utils.PodmanExecOptions {
1472+ FullOutputWriter : io .Discard ,
1473+ }, "build" , "-f" , "build/basicalpine/Containerfile" , "--output" , "type=local,dest=-" )
1474+ session .WaitWithDefaultTimeout ()
1475+ Expect (session ).Should (ExitWithError (125 , `only "type=tar" can be used with "dest=-"` ))
1476+ })
1477+
14381478})
0 commit comments