summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/build.go2
-rw-r--r--test/e2e/build_test.go10
-rw-r--r--test/system/030-run.bats35
3 files changed, 32 insertions, 15 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go
index b8b315c68..acd402fdd 100644
--- a/cmd/podman/build.go
+++ b/cmd/podman/build.go
@@ -342,6 +342,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
}
options := imagebuildah.BuildOptions{
+ Architecture: c.Arch,
CommonBuildOpts: &buildOpts,
AdditionalTags: tags,
Annotations: c.Annotation,
@@ -359,6 +360,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
Layers: layers,
NamespaceOptions: nsValues,
NoCache: c.NoCache,
+ OS: c.OS,
Out: stdout,
Output: output,
OutputFormat: format,
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index b4e400549..240ef1627 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "runtime"
"strings"
. "github.com/containers/libpod/test/utils"
@@ -43,6 +44,15 @@ var _ = Describe("Podman build", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ iid := session.OutputToStringArray()[len(session.OutputToStringArray())-1]
+
+ // Verify that OS and Arch are being set
+ inspect := podmanTest.PodmanNoCache([]string{"inspect", iid})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectImageJSON()
+ Expect(data[0].Os).To(Equal(runtime.GOOS))
+ Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
+
session = podmanTest.PodmanNoCache([]string{"rmi", "alpine"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index b89c76981..98c65f788 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -136,21 +136,26 @@ echo $rand | 0 | $rand
run_podman rmi busybox
}
-# 'run --rmi' deletes the image in the end unless it's used by another container.
-@test "podman run --rmi - remove image" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
- run_podman 0 run --rmi --rm redis /bin/true
- run_podman 1 image exists redis
-}
-
-
-@test "podman run --rmi - not remove image" {
- skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
- run_podman run redis /bin/true
- run_podman images | grep redis
- run_podman run --rmi --rm redis /bin/true
- run_podman images | grep redis
- run_podman 0 rm -a
+# 'run --rmi' deletes the image in the end unless it's used by another container
+@test "podman run --rmi" {
+ skip_if_remote
+
+ # Name of a nonlocal image. It should be pulled in by the first 'run'
+ NONLOCAL_IMAGE=busybox
+ run_podman 1 image exists $NONLOCAL_IMAGE
+
+ # Run a container, without --rm; this should block subsequent --rmi
+ run_podman run --name keepme $NONLOCAL_IMAGE /bin/true
+ run_podman image exists $NONLOCAL_IMAGE
+
+ # Now try running with --rmi : it should succeed, but not remove the image
+ run_podman run --rmi --rm $NONLOCAL_IMAGE /bin/true
+ run_podman image exists $NONLOCAL_IMAGE
+
+ # Remove the stray container, and run one more time with --rmi.
+ run_podman rm keepme
+ run_podman run --rmi --rm $NONLOCAL_IMAGE /bin/true
+ run_podman 1 image exists $NONLOCAL_IMAGE
}
# vim: filetype=sh