mirror of https://github.com/containers/podman.git
Merge pull request #20048 from edsantiago/e2e_check_stderr__more
e2e: ExitCleanly(): more low-hanging fruit
This commit is contained in:
commit
07f8d4451a
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run networking", func() {
|
var _ = Describe("Podman run networking", func() {
|
||||||
|
|
@ -20,16 +20,16 @@ var _ = Describe("Podman run networking", func() {
|
||||||
session := podmanTest.Podman([]string{"network", "create", netName})
|
session := podmanTest.Podman([]string{"network", "create", netName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, NGINX_IMAGE})
|
ctrID := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, NGINX_IMAGE})
|
||||||
ctrID.WaitWithDefaultTimeout()
|
ctrID.WaitWithDefaultTimeout()
|
||||||
Expect(ctrID).Should(Exit(0))
|
Expect(ctrID).Should(ExitCleanly())
|
||||||
cid := ctrID.OutputToString()
|
cid := ctrID.OutputToString()
|
||||||
|
|
||||||
ctrIP := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid})
|
ctrIP := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid})
|
||||||
ctrIP.WaitWithDefaultTimeout()
|
ctrIP.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIP).Should(Exit(0))
|
Expect(ctrIP).Should(ExitCleanly())
|
||||||
cip := ctrIP.OutputToString()
|
cip := ctrIP.OutputToString()
|
||||||
Expect(cip).To(MatchRegexp(IPRegex))
|
Expect(cip).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
reverseLookup := podmanTest.Podman([]string{"exec", cid, "dig", "+short", "-x", cip})
|
reverseLookup := podmanTest.Podman([]string{"exec", cid, "dig", "+short", "-x", cip})
|
||||||
reverseLookup.WaitWithDefaultTimeout()
|
reverseLookup.WaitWithDefaultTimeout()
|
||||||
Expect(reverseLookup).Should(Exit(0))
|
Expect(reverseLookup).Should(ExitCleanly())
|
||||||
revListArray := reverseLookup.OutputToStringArray()
|
revListArray := reverseLookup.OutputToStringArray()
|
||||||
Expect(revListArray).Should(HaveLen(2))
|
Expect(revListArray).Should(HaveLen(2))
|
||||||
Expect(strings.TrimRight(revListArray[0], ".")).To(Equal("aone"))
|
Expect(strings.TrimRight(revListArray[0], ".")).To(Equal("aone"))
|
||||||
|
|
@ -50,27 +50,27 @@ var _ = Describe("Podman run networking", func() {
|
||||||
session := podmanTest.Podman([]string{"network", "create", netName})
|
session := podmanTest.Podman([]string{"network", "create", netName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctr1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, NGINX_IMAGE})
|
ctr1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, NGINX_IMAGE})
|
||||||
ctr1.WaitWithDefaultTimeout()
|
ctr1.WaitWithDefaultTimeout()
|
||||||
Expect(ctr1).Should(Exit(0))
|
Expect(ctr1).Should(ExitCleanly())
|
||||||
cid1 := ctr1.OutputToString()
|
cid1 := ctr1.OutputToString()
|
||||||
|
|
||||||
ctrIP1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid1})
|
ctrIP1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid1})
|
||||||
ctrIP1.WaitWithDefaultTimeout()
|
ctrIP1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIP1).Should(Exit(0))
|
Expect(ctrIP1).Should(ExitCleanly())
|
||||||
cip1 := ctrIP1.OutputToString()
|
cip1 := ctrIP1.OutputToString()
|
||||||
Expect(cip1).To(MatchRegexp(IPRegex))
|
Expect(cip1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
ctr2 := podmanTest.Podman([]string{"run", "-dt", "--name", "atwo", "--network", netName, NGINX_IMAGE})
|
ctr2 := podmanTest.Podman([]string{"run", "-dt", "--name", "atwo", "--network", netName, NGINX_IMAGE})
|
||||||
ctr2.WaitWithDefaultTimeout()
|
ctr2.WaitWithDefaultTimeout()
|
||||||
Expect(ctr2).Should(Exit(0))
|
Expect(ctr2).Should(ExitCleanly())
|
||||||
cid2 := ctr2.OutputToString()
|
cid2 := ctr2.OutputToString()
|
||||||
|
|
||||||
ctrIP2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid2})
|
ctrIP2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), cid2})
|
||||||
ctrIP2.WaitWithDefaultTimeout()
|
ctrIP2.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIP2).Should(Exit(0))
|
Expect(ctrIP2).Should(ExitCleanly())
|
||||||
cip2 := ctrIP2.OutputToString()
|
cip2 := ctrIP2.OutputToString()
|
||||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
Expect(cip2).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
reverseLookup12 := podmanTest.Podman([]string{"exec", cid1, "dig", "+short", "-x", cip2})
|
reverseLookup12 := podmanTest.Podman([]string{"exec", cid1, "dig", "+short", "-x", cip2})
|
||||||
reverseLookup12.WaitWithDefaultTimeout()
|
reverseLookup12.WaitWithDefaultTimeout()
|
||||||
Expect(reverseLookup12).Should(Exit(0))
|
Expect(reverseLookup12).Should(ExitCleanly())
|
||||||
revListArray12 := reverseLookup12.OutputToStringArray()
|
revListArray12 := reverseLookup12.OutputToStringArray()
|
||||||
Expect(revListArray12).Should(HaveLen(2))
|
Expect(revListArray12).Should(HaveLen(2))
|
||||||
Expect(strings.TrimRight(revListArray12[0], ".")).To(Equal("atwo"))
|
Expect(strings.TrimRight(revListArray12[0], ".")).To(Equal("atwo"))
|
||||||
|
|
@ -88,7 +88,7 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
reverseLookup21 := podmanTest.Podman([]string{"exec", cid2, "dig", "+short", "-x", cip1})
|
reverseLookup21 := podmanTest.Podman([]string{"exec", cid2, "dig", "+short", "-x", cip1})
|
||||||
reverseLookup21.WaitWithDefaultTimeout()
|
reverseLookup21.WaitWithDefaultTimeout()
|
||||||
Expect(reverseLookup21).Should(Exit(0))
|
Expect(reverseLookup21).Should(ExitCleanly())
|
||||||
revListArray21 := reverseLookup21.OutputToStringArray()
|
revListArray21 := reverseLookup21.OutputToStringArray()
|
||||||
Expect(revListArray21).Should(HaveLen(2))
|
Expect(revListArray21).Should(HaveLen(2))
|
||||||
Expect(strings.TrimRight(revListArray21[0], ".")).To(Equal("aone"))
|
Expect(strings.TrimRight(revListArray21[0], ".")).To(Equal("aone"))
|
||||||
|
|
@ -101,25 +101,25 @@ var _ = Describe("Podman run networking", func() {
|
||||||
session := podmanTest.Podman([]string{"network", "create", netName})
|
session := podmanTest.Podman([]string{"network", "create", netName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctr1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, "--network-alias", "alias_a1,alias_1a", NGINX_IMAGE})
|
ctr1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netName, "--network-alias", "alias_a1,alias_1a", NGINX_IMAGE})
|
||||||
ctr1.WaitWithDefaultTimeout()
|
ctr1.WaitWithDefaultTimeout()
|
||||||
Expect(ctr1).Should(Exit(0))
|
Expect(ctr1).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrIP1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), "aone"})
|
ctrIP1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), "aone"})
|
||||||
ctrIP1.WaitWithDefaultTimeout()
|
ctrIP1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIP1).Should(Exit(0))
|
Expect(ctrIP1).Should(ExitCleanly())
|
||||||
cip1 := ctrIP1.OutputToString()
|
cip1 := ctrIP1.OutputToString()
|
||||||
Expect(cip1).To(MatchRegexp(IPRegex))
|
Expect(cip1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
ctr2 := podmanTest.Podman([]string{"run", "-dt", "--name", "atwo", "--network", netName, "--network-alias", "alias_a2,alias_2a", NGINX_IMAGE})
|
ctr2 := podmanTest.Podman([]string{"run", "-dt", "--name", "atwo", "--network", netName, "--network-alias", "alias_a2,alias_2a", NGINX_IMAGE})
|
||||||
ctr2.WaitWithDefaultTimeout()
|
ctr2.WaitWithDefaultTimeout()
|
||||||
Expect(ctr2).Should(Exit(0))
|
Expect(ctr2).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrIP2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), "atwo"})
|
ctrIP2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netName), "atwo"})
|
||||||
ctrIP2.WaitWithDefaultTimeout()
|
ctrIP2.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIP2).Should(Exit(0))
|
Expect(ctrIP2).Should(ExitCleanly())
|
||||||
cip2 := ctrIP2.OutputToString()
|
cip2 := ctrIP2.OutputToString()
|
||||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
Expect(cip2).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -142,13 +142,13 @@ var _ = Describe("Podman run networking", func() {
|
||||||
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
||||||
sessionA.WaitWithDefaultTimeout()
|
sessionA.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameA)
|
defer podmanTest.removeNetwork(netNameA)
|
||||||
Expect(sessionA).Should(Exit(0))
|
Expect(sessionA).Should(ExitCleanly())
|
||||||
|
|
||||||
netNameB := createNetworkName("TestB")
|
netNameB := createNetworkName("TestB")
|
||||||
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
||||||
sessionB.WaitWithDefaultTimeout()
|
sessionB.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameB)
|
defer podmanTest.removeNetwork(netNameB)
|
||||||
Expect(sessionB).Should(Exit(0))
|
Expect(sessionB).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrA1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
ctrA1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
||||||
ctrA1.WaitWithDefaultTimeout()
|
ctrA1.WaitWithDefaultTimeout()
|
||||||
|
|
@ -160,24 +160,24 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
ctrIPA1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA1})
|
ctrIPA1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA1})
|
||||||
ctrIPA1.WaitWithDefaultTimeout()
|
ctrIPA1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPA1).Should(Exit(0))
|
Expect(ctrIPA1).Should(ExitCleanly())
|
||||||
cipA1 := ctrIPA1.OutputToString()
|
cipA1 := ctrIPA1.OutputToString()
|
||||||
Expect(cipA1).To(MatchRegexp(IPRegex))
|
Expect(cipA1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
ctrIPB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidB1})
|
ctrIPB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidB1})
|
||||||
ctrIPB1.WaitWithDefaultTimeout()
|
ctrIPB1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPB1).Should(Exit(0))
|
Expect(ctrIPB1).Should(ExitCleanly())
|
||||||
cipB1 := ctrIPB1.OutputToString()
|
cipB1 := ctrIPB1.OutputToString()
|
||||||
Expect(cipB1).To(MatchRegexp(IPRegex))
|
Expect(cipB1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
resA1B1 := podmanTest.Podman([]string{"exec", "aone", "dig", "+short", "bone"})
|
resA1B1 := podmanTest.Podman([]string{"exec", "aone", "dig", "+short", "bone"})
|
||||||
resA1B1.WaitWithDefaultTimeout()
|
resA1B1.WaitWithDefaultTimeout()
|
||||||
Expect(resA1B1).Should(Exit(0))
|
Expect(resA1B1).Should(ExitCleanly())
|
||||||
Expect(resA1B1.OutputToString()).To(Equal(""))
|
Expect(resA1B1.OutputToString()).To(Equal(""))
|
||||||
|
|
||||||
resB1A1 := podmanTest.Podman([]string{"exec", "bone", "dig", "+short", "aone"})
|
resB1A1 := podmanTest.Podman([]string{"exec", "bone", "dig", "+short", "aone"})
|
||||||
resB1A1.WaitWithDefaultTimeout()
|
resB1A1.WaitWithDefaultTimeout()
|
||||||
Expect(resB1A1).Should(Exit(0))
|
Expect(resB1A1).Should(ExitCleanly())
|
||||||
Expect(resB1A1.OutputToString()).To(Equal(""))
|
Expect(resB1A1.OutputToString()).To(Equal(""))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -186,13 +186,13 @@ var _ = Describe("Podman run networking", func() {
|
||||||
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
||||||
sessionA.WaitWithDefaultTimeout()
|
sessionA.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameA)
|
defer podmanTest.removeNetwork(netNameA)
|
||||||
Expect(sessionA).Should(Exit(0))
|
Expect(sessionA).Should(ExitCleanly())
|
||||||
|
|
||||||
netNameB := createNetworkName("TestB")
|
netNameB := createNetworkName("TestB")
|
||||||
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
||||||
sessionB.WaitWithDefaultTimeout()
|
sessionB.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameB)
|
defer podmanTest.removeNetwork(netNameB)
|
||||||
Expect(sessionB).Should(Exit(0))
|
Expect(sessionB).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrA1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
ctrA1 := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
||||||
ctrA1.WaitWithDefaultTimeout()
|
ctrA1.WaitWithDefaultTimeout()
|
||||||
|
|
@ -200,7 +200,7 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
ctrIPA1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA1})
|
ctrIPA1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA1})
|
||||||
ctrIPA1.WaitWithDefaultTimeout()
|
ctrIPA1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPA1).Should(Exit(0))
|
Expect(ctrIPA1).Should(ExitCleanly())
|
||||||
cipA1 := ctrIPA1.OutputToString()
|
cipA1 := ctrIPA1.OutputToString()
|
||||||
Expect(cipA1).To(MatchRegexp(IPRegex))
|
Expect(cipA1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -210,7 +210,7 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
ctrIPB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidB1})
|
ctrIPB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidB1})
|
||||||
ctrIPB1.WaitWithDefaultTimeout()
|
ctrIPB1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPB1).Should(Exit(0))
|
Expect(ctrIPB1).Should(ExitCleanly())
|
||||||
cipB1 := ctrIPB1.OutputToString()
|
cipB1 := ctrIPB1.OutputToString()
|
||||||
Expect(cipB1).To(MatchRegexp(IPRegex))
|
Expect(cipB1).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -220,13 +220,13 @@ var _ = Describe("Podman run networking", func() {
|
||||||
|
|
||||||
ctrIPA2B21 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA2B2})
|
ctrIPA2B21 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameA), cidA2B2})
|
||||||
ctrIPA2B21.WaitWithDefaultTimeout()
|
ctrIPA2B21.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPA2B21).Should(Exit(0))
|
Expect(ctrIPA2B21).Should(ExitCleanly())
|
||||||
cipA2B21 := ctrIPA2B21.OutputToString()
|
cipA2B21 := ctrIPA2B21.OutputToString()
|
||||||
Expect(cipA2B21).To(MatchRegexp(IPRegex))
|
Expect(cipA2B21).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
ctrIPA2B22 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidA2B2})
|
ctrIPA2B22 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), cidA2B2})
|
||||||
ctrIPA2B22.WaitWithDefaultTimeout()
|
ctrIPA2B22.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPA2B22).Should(Exit(0))
|
Expect(ctrIPA2B22).Should(ExitCleanly())
|
||||||
cipA2B22 := ctrIPA2B22.OutputToString()
|
cipA2B22 := ctrIPA2B22.OutputToString()
|
||||||
Expect(cipA2B22).To(MatchRegexp(IPRegex))
|
Expect(cipA2B22).To(MatchRegexp(IPRegex))
|
||||||
|
|
||||||
|
|
@ -244,44 +244,44 @@ var _ = Describe("Podman run networking", func() {
|
||||||
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
sessionA := podmanTest.Podman([]string{"network", "create", netNameA})
|
||||||
sessionA.WaitWithDefaultTimeout()
|
sessionA.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameA)
|
defer podmanTest.removeNetwork(netNameA)
|
||||||
Expect(sessionA).Should(Exit(0))
|
Expect(sessionA).Should(ExitCleanly())
|
||||||
|
|
||||||
netNameB := createNetworkName("TestB")
|
netNameB := createNetworkName("TestB")
|
||||||
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
sessionB := podmanTest.Podman([]string{"network", "create", netNameB})
|
||||||
sessionB.WaitWithDefaultTimeout()
|
sessionB.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameB)
|
defer podmanTest.removeNetwork(netNameB)
|
||||||
Expect(sessionB).Should(Exit(0))
|
Expect(sessionB).Should(ExitCleanly())
|
||||||
|
|
||||||
netNameC := createNetworkName("TestC")
|
netNameC := createNetworkName("TestC")
|
||||||
sessionC := podmanTest.Podman([]string{"network", "create", netNameC})
|
sessionC := podmanTest.Podman([]string{"network", "create", netNameC})
|
||||||
sessionC.WaitWithDefaultTimeout()
|
sessionC.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netNameC)
|
defer podmanTest.removeNetwork(netNameC)
|
||||||
Expect(sessionC).Should(Exit(0))
|
Expect(sessionC).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrA := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
ctrA := podmanTest.Podman([]string{"run", "-dt", "--name", "aone", "--network", netNameA, NGINX_IMAGE})
|
||||||
ctrA.WaitWithDefaultTimeout()
|
ctrA.WaitWithDefaultTimeout()
|
||||||
Expect(ctrA).Should(Exit(0))
|
Expect(ctrA).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrC := podmanTest.Podman([]string{"run", "-dt", "--name", "cone", "--network", netNameC, NGINX_IMAGE})
|
ctrC := podmanTest.Podman([]string{"run", "-dt", "--name", "cone", "--network", netNameC, NGINX_IMAGE})
|
||||||
ctrC.WaitWithDefaultTimeout()
|
ctrC.WaitWithDefaultTimeout()
|
||||||
Expect(ctrC).Should(Exit(0))
|
Expect(ctrC).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrnetAB1 := podmanTest.Podman([]string{"network", "connect", "--alias", "testB1_nw", netNameB, "aone"})
|
ctrnetAB1 := podmanTest.Podman([]string{"network", "connect", "--alias", "testB1_nw", netNameB, "aone"})
|
||||||
ctrnetAB1.WaitWithDefaultTimeout()
|
ctrnetAB1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrnetAB1).Should(Exit(0))
|
Expect(ctrnetAB1).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrIPAB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), "aone"})
|
ctrIPAB1 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), "aone"})
|
||||||
ctrIPAB1.WaitWithDefaultTimeout()
|
ctrIPAB1.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPAB1).Should(Exit(0))
|
Expect(ctrIPAB1).Should(ExitCleanly())
|
||||||
cipAB1 := ctrIPAB1.OutputToString()
|
cipAB1 := ctrIPAB1.OutputToString()
|
||||||
|
|
||||||
ctrnetCB2 := podmanTest.Podman([]string{"network", "connect", "--alias", "testB2_nw", netNameB, "cone"})
|
ctrnetCB2 := podmanTest.Podman([]string{"network", "connect", "--alias", "testB2_nw", netNameB, "cone"})
|
||||||
ctrnetCB2.WaitWithDefaultTimeout()
|
ctrnetCB2.WaitWithDefaultTimeout()
|
||||||
Expect(ctrnetCB2).Should(Exit(0))
|
Expect(ctrnetCB2).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrIPCB2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), "cone"})
|
ctrIPCB2 := podmanTest.Podman([]string{"inspect", "--format", fmt.Sprintf(`{{.NetworkSettings.Networks.%s.IPAddress}}`, netNameB), "cone"})
|
||||||
ctrIPCB2.WaitWithDefaultTimeout()
|
ctrIPCB2.WaitWithDefaultTimeout()
|
||||||
Expect(ctrIPCB2).Should(Exit(0))
|
Expect(ctrIPCB2).Should(ExitCleanly())
|
||||||
cipCB2 := ctrIPCB2.OutputToString()
|
cipCB2 := ctrIPCB2.OutputToString()
|
||||||
|
|
||||||
digShort("aone", "testB2_nw", cipCB2, podmanTest)
|
digShort("aone", "testB2_nw", cipCB2, podmanTest)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// wip
|
// wip
|
||||||
|
|
@ -33,7 +32,7 @@ var _ = Describe("Podman run", func() {
|
||||||
skipIfAppArmorDisabled()
|
skipIfAppArmorDisabled()
|
||||||
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -45,7 +44,7 @@ var _ = Describe("Podman run", func() {
|
||||||
skipIfAppArmorDisabled()
|
skipIfAppArmorDisabled()
|
||||||
session := podmanTest.Podman([]string{"create", "--privileged", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "--privileged", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -57,7 +56,7 @@ var _ = Describe("Podman run", func() {
|
||||||
skipIfAppArmorDisabled()
|
skipIfAppArmorDisabled()
|
||||||
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), "--privileged", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), "--privileged", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -84,11 +83,11 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
||||||
aaFile := filepath.Join(os.TempDir(), "aaFile")
|
aaFile := filepath.Join(os.TempDir(), "aaFile")
|
||||||
Expect(os.WriteFile(aaFile, []byte(aaProfile), 0755)).To(Succeed())
|
Expect(os.WriteFile(aaFile, []byte(aaProfile), 0755)).To(Succeed())
|
||||||
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
|
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
|
||||||
Expect(parse).Should(Exit(0))
|
Expect(parse).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -107,7 +106,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
||||||
skipIfAppArmorDisabled()
|
skipIfAppArmorDisabled()
|
||||||
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -128,7 +127,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
||||||
// Should succeed if user specifies apparmor on disabled system
|
// Should succeed if user specifies apparmor on disabled system
|
||||||
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
@ -141,7 +140,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
// Verify that apparmor.Profile is being set
|
// Verify that apparmor.Profile is being set
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const cgroupRoot = "/sys/fs/cgroup"
|
const cgroupRoot = "/sys/fs/cgroup"
|
||||||
|
|
@ -27,7 +26,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||||
cgroup := "/zzz"
|
cgroup := "/zzz"
|
||||||
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/self/cgroup"})
|
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/self/cgroup"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -42,7 +41,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||||
}
|
}
|
||||||
run := podmanTest.Podman([]string{"run", "--cgroupns=host", fedoraMinimal, "cat", "/proc/self/cgroup"})
|
run := podmanTest.Podman([]string{"run", "--cgroupns=host", fedoraMinimal, "cat", "/proc/self/cgroup"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -57,12 +56,12 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||||
|
|
||||||
run := podmanTest.Podman([]string{"run", "-d", "--cgroupns=host", fedoraMinimal, "sleep", "100"})
|
run := podmanTest.Podman([]string{"run", "-d", "--cgroupns=host", fedoraMinimal, "sleep", "100"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
cid := run.OutputToString()
|
cid := run.OutputToString()
|
||||||
|
|
||||||
exec := podmanTest.Podman([]string{"exec", cid, "cat", "/proc/1/cgroup"})
|
exec := podmanTest.Podman([]string{"exec", cid, "cat", "/proc/1/cgroup"})
|
||||||
exec.WaitWithDefaultTimeout()
|
exec.WaitWithDefaultTimeout()
|
||||||
Expect(exec).Should(Exit(0))
|
Expect(exec).Should(ExitCleanly())
|
||||||
|
|
||||||
containerCgroup := strings.TrimRight(strings.ReplaceAll(exec.OutputToString(), "0::", ""), "\n")
|
containerCgroup := strings.TrimRight(strings.ReplaceAll(exec.OutputToString(), "0::", ""), "\n")
|
||||||
|
|
||||||
|
|
@ -81,7 +80,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||||
|
|
||||||
run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "--rm", "--cgroupns=host", fmt.Sprintf("--cgroup-parent=%s", newCgroup), fedoraMinimal, "cat", "/proc/self/cgroup"})
|
run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "--rm", "--cgroupns=host", fmt.Sprintf("--cgroup-parent=%s", newCgroup), fedoraMinimal, "cat", "/proc/self/cgroup"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
cgroupEffective := strings.TrimRight(strings.ReplaceAll(run.OutputToString(), "0::", ""), "\n")
|
cgroupEffective := strings.TrimRight(strings.ReplaceAll(run.OutputToString(), "0::", ""), "\n")
|
||||||
|
|
||||||
Expect(newCgroup).To(Equal(filepath.Dir(cgroupEffective)))
|
Expect(newCgroup).To(Equal(filepath.Dir(cgroupEffective)))
|
||||||
|
|
@ -94,7 +93,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||||
cgroup := "aaaa.slice"
|
cgroup := "aaaa.slice"
|
||||||
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/1/cgroup"})
|
run := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroup-parent", cgroup, fedoraMinimal, "cat", "/proc/1/cgroup"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
Expect(run.OutputToString()).To(ContainSubstring(cgroup))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run exit", func() {
|
var _ = Describe("Podman run exit", func() {
|
||||||
|
|
@ -16,33 +15,33 @@ var _ = Describe("Podman run exit", func() {
|
||||||
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
|
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
cid := result.OutputToString()
|
cid := result.OutputToString()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
|
|
||||||
mount := SystemExec("mount", nil)
|
mount := SystemExec("mount", nil)
|
||||||
Expect(mount).Should(Exit(0))
|
Expect(mount).Should(ExitCleanly())
|
||||||
Expect(mount.OutputToString()).To(ContainSubstring(cid))
|
Expect(mount.OutputToString()).To(ContainSubstring(cid))
|
||||||
|
|
||||||
pmount := podmanTest.Podman([]string{"mount", "--no-trunc"})
|
pmount := podmanTest.Podman([]string{"mount", "--no-trunc"})
|
||||||
pmount.WaitWithDefaultTimeout()
|
pmount.WaitWithDefaultTimeout()
|
||||||
Expect(pmount).Should(Exit(0))
|
Expect(pmount).Should(ExitCleanly())
|
||||||
Expect(pmount.OutputToString()).To(ContainSubstring(cid))
|
Expect(pmount.OutputToString()).To(ContainSubstring(cid))
|
||||||
|
|
||||||
stop := podmanTest.Podman([]string{"stop", cid})
|
stop := podmanTest.Podman([]string{"stop", cid})
|
||||||
stop.WaitWithDefaultTimeout()
|
stop.WaitWithDefaultTimeout()
|
||||||
Expect(stop).Should(Exit(0))
|
Expect(stop).Should(ExitCleanly())
|
||||||
|
|
||||||
// We have to force cleanup so the unmount happens
|
// We have to force cleanup so the unmount happens
|
||||||
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
|
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
|
||||||
podmanCleanupSession.WaitWithDefaultTimeout()
|
podmanCleanupSession.WaitWithDefaultTimeout()
|
||||||
Expect(podmanCleanupSession).Should(Exit(0))
|
Expect(podmanCleanupSession).Should(ExitCleanly())
|
||||||
|
|
||||||
mount = SystemExec("mount", nil)
|
mount = SystemExec("mount", nil)
|
||||||
Expect(mount).Should(Exit(0))
|
Expect(mount).Should(ExitCleanly())
|
||||||
Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
|
Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
|
||||||
|
|
||||||
pmount = podmanTest.Podman([]string{"mount", "--no-trunc"})
|
pmount = podmanTest.Podman([]string{"mount", "--no-trunc"})
|
||||||
pmount.WaitWithDefaultTimeout()
|
pmount.WaitWithDefaultTimeout()
|
||||||
Expect(pmount).Should(Exit(0))
|
Expect(pmount).Should(ExitCleanly())
|
||||||
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
|
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -53,11 +52,11 @@ var _ = Describe("Podman run exit", func() {
|
||||||
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
|
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
cid := result.OutputToString()
|
cid := result.OutputToString()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
|
|
||||||
mount := podmanTest.Podman([]string{"unshare", "mount"})
|
mount := podmanTest.Podman([]string{"unshare", "mount"})
|
||||||
mount.WaitWithDefaultTimeout()
|
mount.WaitWithDefaultTimeout()
|
||||||
Expect(mount).Should(Exit(0))
|
Expect(mount).Should(ExitCleanly())
|
||||||
Expect(mount.OutputToString()).To(ContainSubstring(cid))
|
Expect(mount.OutputToString()).To(ContainSubstring(cid))
|
||||||
|
|
||||||
// command: podman <options> unshare podman <options> image mount ALPINE
|
// command: podman <options> unshare podman <options> image mount ALPINE
|
||||||
|
|
@ -67,26 +66,26 @@ var _ = Describe("Podman run exit", func() {
|
||||||
|
|
||||||
pmount := podmanTest.Podman(args)
|
pmount := podmanTest.Podman(args)
|
||||||
pmount.WaitWithDefaultTimeout()
|
pmount.WaitWithDefaultTimeout()
|
||||||
Expect(pmount).Should(Exit(0))
|
Expect(pmount).Should(ExitCleanly())
|
||||||
Expect(pmount.OutputToString()).To(ContainSubstring(cid))
|
Expect(pmount.OutputToString()).To(ContainSubstring(cid))
|
||||||
|
|
||||||
stop := podmanTest.Podman([]string{"stop", cid})
|
stop := podmanTest.Podman([]string{"stop", cid})
|
||||||
stop.WaitWithDefaultTimeout()
|
stop.WaitWithDefaultTimeout()
|
||||||
Expect(stop).Should(Exit(0))
|
Expect(stop).Should(ExitCleanly())
|
||||||
|
|
||||||
// We have to force cleanup so the unmount happens
|
// We have to force cleanup so the unmount happens
|
||||||
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
|
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
|
||||||
podmanCleanupSession.WaitWithDefaultTimeout()
|
podmanCleanupSession.WaitWithDefaultTimeout()
|
||||||
Expect(podmanCleanupSession).Should(Exit(0))
|
Expect(podmanCleanupSession).Should(ExitCleanly())
|
||||||
|
|
||||||
mount = podmanTest.Podman([]string{"unshare", "mount"})
|
mount = podmanTest.Podman([]string{"unshare", "mount"})
|
||||||
mount.WaitWithDefaultTimeout()
|
mount.WaitWithDefaultTimeout()
|
||||||
Expect(mount).Should(Exit(0))
|
Expect(mount).Should(ExitCleanly())
|
||||||
Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
|
Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
|
||||||
|
|
||||||
pmount = podmanTest.Podman(args)
|
pmount = podmanTest.Podman(args)
|
||||||
pmount.WaitWithDefaultTimeout()
|
pmount.WaitWithDefaultTimeout()
|
||||||
Expect(pmount).Should(Exit(0))
|
Expect(pmount).Should(ExitCleanly())
|
||||||
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
|
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
|
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
|
||||||
}
|
}
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring("5000"))
|
Expect(result.OutputToString()).To(ContainSubstring("5000"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
result = podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
||||||
}
|
}
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring("5000"))
|
Expect(result.OutputToString()).To(ContainSubstring("5000"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -50,17 +50,17 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
if CGROUPSV2 {
|
if CGROUPSV2 {
|
||||||
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
|
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.max"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("5000 100000"))
|
Expect(result.OutputToString()).To(Equal("5000 100000"))
|
||||||
} else {
|
} else {
|
||||||
result := podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
|
result := podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("100000"))
|
Expect(result.OutputToString()).To(Equal("100000"))
|
||||||
|
|
||||||
result = podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
result = podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("50000"))
|
Expect(result.OutputToString()).To(Equal("50000"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -70,12 +70,12 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
// [2-262144] is mapped to [1-10000]
|
// [2-262144] is mapped to [1-10000]
|
||||||
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"})
|
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=262144", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/cpu.weight"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("10000"))
|
Expect(result.OutputToString()).To(Equal("10000"))
|
||||||
} else {
|
} else {
|
||||||
result := podmanTest.Podman([]string{"run", "--rm", "-c", "2", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
|
result := podmanTest.Podman([]string{"run", "--rm", "-c", "2", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("2"))
|
Expect(result.OutputToString()).To(Equal("2"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -89,7 +89,7 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
|
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
|
||||||
}
|
}
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("0"))
|
Expect(result.OutputToString()).To(Equal("0"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ var _ = Describe("Podman run cpu", func() {
|
||||||
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
|
result = podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
|
||||||
}
|
}
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(Equal("0"))
|
Expect(result.OutputToString()).To(Equal("0"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ var _ = Describe("Podman run device", func() {
|
||||||
It("podman run device test", func() {
|
It("podman run device test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg", ALPINE, "test", "-c", "/dev/kmsg"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg", ALPINE, "test", "-c", "/dev/kmsg"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
if !isRootless() {
|
if !isRootless() {
|
||||||
session = podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg", "--cap-add", "SYS_ADMIN", ALPINE, "head", "-n", "1", "/dev/kmsg"})
|
session = podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg", "--cap-add", "SYS_ADMIN", ALPINE, "head", "-n", "1", "/dev/kmsg"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -48,21 +48,21 @@ var _ = Describe("Podman run device", func() {
|
||||||
// TODO: Confirm absence of /dev/kmsg in container
|
// TODO: Confirm absence of /dev/kmsg in container
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1", ALPINE, "test", "-c", "/dev/kmsg1"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1", ALPINE, "test", "-c", "/dev/kmsg1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run device permission test", func() {
|
It("podman run device permission test", func() {
|
||||||
// TODO: Confirm write-permission failure
|
// TODO: Confirm write-permission failure
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:r", ALPINE, "test", "-r", "/dev/kmsg"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:r", ALPINE, "test", "-r", "/dev/kmsg"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run device rename and permission test", func() {
|
It("podman run device rename and permission test", func() {
|
||||||
// TODO: Confirm write-permission failure
|
// TODO: Confirm write-permission failure
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1:r", ALPINE, "test", "-r", "/dev/kmsg1"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1:r", ALPINE, "test", "-r", "/dev/kmsg1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
It("podman run device rename and bad permission test", func() {
|
It("podman run device rename and bad permission test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1:rd", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "/dev/kmsg:/dev/kmsg1:rd", ALPINE, "true"})
|
||||||
|
|
@ -79,18 +79,18 @@ var _ = Describe("Podman run device", func() {
|
||||||
|
|
||||||
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
||||||
mknod.WaitWithDefaultTimeout()
|
mknod.WaitWithDefaultTimeout()
|
||||||
Expect(mknod).Should(Exit(0))
|
Expect(mknod).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--device", devdir + ":/dev/bar", ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
|
session := podmanTest.Podman([]string{"run", "-q", "--device", devdir + ":/dev/bar", ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("1:3"))
|
Expect(session.OutputToString()).To(Equal("1:3"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run device host device with --privileged", func() {
|
It("podman run device host device with --privileged", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "test", "-c", "/dev/kmsg"})
|
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "test", "-c", "/dev/kmsg"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
// verify --privileged is required
|
// verify --privileged is required
|
||||||
session2 := podmanTest.Podman([]string{"run", ALPINE, "test", "-c", "/dev/kmsg"})
|
session2 := podmanTest.Podman([]string{"run", ALPINE, "test", "-c", "/dev/kmsg"})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
|
|
@ -111,24 +111,24 @@ var _ = Describe("Podman run device", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "vendor.com/device=myKmsg", ALPINE, "test", "-c", "/dev/kmsg1"})
|
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "vendor.com/device=myKmsg", ALPINE, "test", "-c", "/dev/kmsg1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
createContainersConfFileWithDevices(podmanTest, "\"vendor.com/device=myKmsg\"")
|
createContainersConfFileWithDevices(podmanTest, "\"vendor.com/device=myKmsg\"")
|
||||||
session = podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", ALPINE, "test", "-c", "/dev/kmsg1"})
|
session = podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", ALPINE, "test", "-c", "/dev/kmsg1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run --gpus noop", func() {
|
It("podman run --gpus noop", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--gpus", "all", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "--gpus", "all", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run cannot access non default devices", func() {
|
It("podman run cannot access non default devices", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-v /dev:/dev-host", ALPINE, "head", "-1", "/dev-host/kmsg"})
|
session := podmanTest.Podman([]string{"run", "-v /dev:/dev-host", ALPINE, "head", "-1", "/dev-host/kmsg"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Not(Exit(0)))
|
Expect(session).Should(Not(ExitCleanly()))
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run dns", func() {
|
var _ = Describe("Podman run dns", func() {
|
||||||
|
|
@ -12,14 +11,14 @@ var _ = Describe("Podman run dns", func() {
|
||||||
It("podman run add search domain", func() {
|
It("podman run add search domain", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("search foobar.com")))
|
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("search foobar.com")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run remove all search domain", func() {
|
It("podman run remove all search domain", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(Not(ContainElement(HavePrefix("search"))))
|
Expect(session.OutputToStringArray()).To(Not(ContainElement(HavePrefix("search"))))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -32,7 +31,7 @@ var _ = Describe("Podman run dns", func() {
|
||||||
It("podman run add dns server", func() {
|
It("podman run add dns server", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", ALPINE, "cat", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("nameserver 1.2.3.4")))
|
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("nameserver 1.2.3.4")))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -40,7 +39,7 @@ var _ = Describe("Podman run dns", func() {
|
||||||
It("podman run add dns option", func() {
|
It("podman run add dns option", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--dns-opt=debug", ALPINE, "cat", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", "--dns-opt=debug", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("options debug")))
|
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("options debug")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -53,26 +52,26 @@ var _ = Describe("Podman run dns", func() {
|
||||||
It("podman run add host", func() {
|
It("podman run add host", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--add-host=foobar:1.1.1.1", "--add-host=foobaz:2001:db8::68", ALPINE, "cat", "/etc/hosts"})
|
session := podmanTest.Podman([]string{"run", "--add-host=foobar:1.1.1.1", "--add-host=foobaz:2001:db8::68", ALPINE, "cat", "/etc/hosts"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElements(HavePrefix("1.1.1.1\tfoobar"), HavePrefix("2001:db8::68\tfoobaz")))
|
Expect(session.OutputToStringArray()).To(ContainElements(HavePrefix("1.1.1.1\tfoobar"), HavePrefix("2001:db8::68\tfoobaz")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run add hostname", func() {
|
It("podman run add hostname", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hostname"})
|
session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hostname"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("foobar"))
|
Expect(session.OutputToString()).To(Equal("foobar"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "hostname"})
|
session = podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "hostname"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("foobar"))
|
Expect(session.OutputToString()).To(Equal("foobar"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run add hostname sets /etc/hosts", func() {
|
It("podman run add hostname sets /etc/hosts", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
|
session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("foobar"))
|
Expect(session.OutputToString()).To(ContainSubstring("foobar"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -91,6 +90,6 @@ var _ = Describe("Podman run dns", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--dns=1.2.3.4", "--network", "host", ALPINE})
|
session = podmanTest.Podman([]string{"run", "--dns=1.2.3.4", "--network", "host", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -27,7 +28,7 @@ CMD []
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("hello"))
|
Expect(session.OutputToString()).To(Equal("hello"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -38,7 +39,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
|
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -50,7 +51,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
|
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
|
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -73,7 +74,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
|
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -85,12 +86,12 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest"})
|
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("Linux")))
|
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("Linux")))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--entrypoint", "", "foobar.com/entrypoint:latest", "uname"})
|
session = podmanTest.Podman([]string{"run", "--entrypoint", "", "foobar.com/entrypoint:latest", "uname"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("Linux")))
|
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("Linux")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -102,7 +103,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
|
||||||
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest", "-r"})
|
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest", "-r"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(Not(ContainElement(HavePrefix("Linux"))))
|
Expect(session.OutputToStringArray()).To(Not(ContainElement(HavePrefix("Linux"))))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package integration
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -13,40 +14,40 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman run environment test", func() {
|
It("podman run environment test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOME"})
|
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOME"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/root"))
|
Expect(session.OutputToString()).To(ContainSubstring("/root"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "2", ALPINE, "printenv", "HOME"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "2", ALPINE, "printenv", "HOME"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/sbin"))
|
Expect(session.OutputToString()).To(ContainSubstring("/sbin"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--env", "HOME=/foo", ALPINE, "printenv", "HOME"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--env", "HOME=/foo", ALPINE, "printenv", "HOME"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/foo"))
|
Expect(session.OutputToString()).To(ContainSubstring("/foo"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("BAR,BAZ"))
|
Expect(session.OutputToString()).To(ContainSubstring("BAR,BAZ"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--env", "PATH=/bin", ALPINE, "printenv", "PATH"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--env", "PATH=/bin", ALPINE, "printenv", "PATH"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/bin"))
|
Expect(session.OutputToString()).To(ContainSubstring("/bin"))
|
||||||
|
|
||||||
// Verify environ keys with spaces do not blow up podman command
|
// Verify environ keys with spaces do not blow up podman command
|
||||||
os.Setenv("FOO BAR", "BAZ")
|
os.Setenv("FOO BAR", "BAZ")
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"})
|
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
os.Unsetenv("FOO BAR")
|
os.Unsetenv("FOO BAR")
|
||||||
|
|
||||||
os.Setenv("FOO", "BAR")
|
os.Setenv("FOO", "BAR")
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO", ALPINE, "printenv", "FOO"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO", ALPINE, "printenv", "FOO"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("BAR"))
|
Expect(session.OutputToString()).To(ContainSubstring("BAR"))
|
||||||
os.Unsetenv("FOO")
|
os.Unsetenv("FOO")
|
||||||
|
|
||||||
|
|
@ -57,13 +58,13 @@ var _ = Describe("Podman run", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv"})
|
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// This currently does not work
|
// This currently does not work
|
||||||
// Re-enable when hostname is an env variable
|
// Re-enable when hostname is an env variable
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "printenv"})
|
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "sh", "-c", "printenv"})
|
||||||
session.Wait(10)
|
session.Wait(10)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("HOSTNAME"))
|
Expect(session.OutputToString()).To(ContainSubstring("HOSTNAME"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -74,12 +75,12 @@ ENV hello=world
|
||||||
podmanTest.BuildImage(dockerfile, "test", "false")
|
podmanTest.BuildImage(dockerfile, "test", "false")
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--env-merge", "hello=${hello}-earth", "test", "env"})
|
session := podmanTest.Podman([]string{"run", "--rm", "--env-merge", "hello=${hello}-earth", "test", "env"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("world-earth"))
|
Expect(session.OutputToString()).To(ContainSubstring("world-earth"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--env-merge", "foo=${bar}-earth", "test", "printenv", "foo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--env-merge", "foo=${bar}-earth", "test", "printenv", "foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("-earth"))
|
Expect(session.OutputToString()).To(Equal("-earth"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -93,12 +94,12 @@ ENV hello=world
|
||||||
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag: --env-host"))
|
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag: --env-host"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("BAR"))
|
Expect(session.OutputToString()).To(ContainSubstring("BAR"))
|
||||||
|
|
||||||
session = podmanTest.PodmanAsUser([]string{"run", "--rm", "--env", "FOO=BAR1", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env)
|
session = podmanTest.PodmanAsUser([]string{"run", "--rm", "--env", "FOO=BAR1", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("BAR1"))
|
Expect(session.OutputToString()).To(ContainSubstring("BAR1"))
|
||||||
os.Unsetenv("FOO")
|
os.Unsetenv("FOO")
|
||||||
})
|
})
|
||||||
|
|
@ -119,7 +120,7 @@ ENV hello=world
|
||||||
}
|
}
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"})
|
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "http_proxy"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
|
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--http-proxy=false", ALPINE, "printenv", "http_proxy"})
|
session = podmanTest.Podman([]string{"run", "--http-proxy=false", ALPINE, "printenv", "http_proxy"})
|
||||||
|
|
@ -129,12 +130,12 @@ ENV hello=world
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
|
session = podmanTest.Podman([]string{"run", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
|
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--http-proxy=false", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
|
session = podmanTest.Podman([]string{"run", "--http-proxy=false", "--env", "http_proxy=5.6.7.8", ALPINE, "printenv", "http_proxy"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
|
Expect(session.OutputToString()).To(ContainSubstring("5.6.7.8"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/podman/v4/libpod/define"
|
"github.com/containers/podman/v4/libpod/define"
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -32,7 +33,7 @@ var _ = Describe("Podman run exit", func() {
|
||||||
It("podman run exit 0", func() {
|
It("podman run exit 0", func() {
|
||||||
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
|
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run exit 50", func() {
|
It("podman run exit 50", func() {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ package integration
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run memory", func() {
|
var _ = Describe("Podman run memory", func() {
|
||||||
|
|
@ -23,7 +23,7 @@ var _ = Describe("Podman run memory", func() {
|
||||||
session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
|
session = podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
|
||||||
}
|
}
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("41943040"))
|
Expect(session.OutputToString()).To(Equal("41943040"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ var _ = Describe("Podman run memory", func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("41943040"))
|
Expect(session.OutputToString()).To(Equal("41943040"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ var _ = Describe("Podman run memory", func() {
|
||||||
expect = "31457280"
|
expect = "31457280"
|
||||||
}
|
}
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(expect))
|
Expect(session.OutputToString()).To(Equal(expect))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ var _ = Describe("Podman run memory", func() {
|
||||||
SkipIfCgroupV2("memory-swappiness not supported on cgroupV2")
|
SkipIfCgroupV2("memory-swappiness not supported on cgroupV2")
|
||||||
session := podmanTest.Podman([]string{"run", fmt.Sprintf("--memory-swappiness=%s", limit), ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
|
session := podmanTest.Podman([]string{"run", fmt.Sprintf("--memory-swappiness=%s", limit), ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(limit))
|
Expect(session.OutputToString()).To(Equal(limit))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run ns", func() {
|
var _ = Describe("Podman run ns", func() {
|
||||||
|
|
@ -16,12 +15,12 @@ var _ = Describe("Podman run ns", func() {
|
||||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "bash", "-c", "echo $$"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "bash", "-c", "echo $$"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("1"))
|
Expect(session.OutputToString()).To(Equal("1"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pid=host", fedoraMinimal, "bash", "-c", "echo $$"})
|
session = podmanTest.Podman([]string{"run", "--pid=host", fedoraMinimal, "bash", "-c", "echo $$"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(Equal("1")))
|
Expect(session.OutputToString()).To(Not(Equal("1")))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pid=badpid", fedoraMinimal, "bash", "-c", "echo $$"})
|
session = podmanTest.Podman([]string{"run", "--pid=badpid", fedoraMinimal, "bash", "-c", "echo $$"})
|
||||||
|
|
@ -32,7 +31,7 @@ var _ = Describe("Podman run ns", func() {
|
||||||
It("podman run --cgroup private test", func() {
|
It("podman run --cgroup private test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--cgroupns=private", fedoraMinimal, "cat", "/proc/self/cgroup"})
|
session := podmanTest.Podman([]string{"run", "--cgroupns=private", fedoraMinimal, "cat", "/proc/self/cgroup"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
Expect(output).ToNot(ContainSubstring("slice"))
|
Expect(output).ToNot(ContainSubstring("slice"))
|
||||||
|
|
@ -40,41 +39,41 @@ var _ = Describe("Podman run ns", func() {
|
||||||
|
|
||||||
It("podman run ipcns test", func() {
|
It("podman run ipcns test", func() {
|
||||||
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
|
setup := SystemExec("ls", []string{"--inode", "-d", "/dev/shm"})
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(ExitCleanly())
|
||||||
hostShm := setup.OutputToString()
|
hostShm := setup.OutputToString()
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ls", "--inode", "-d", "/dev/shm"})
|
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ls", "--inode", "-d", "/dev/shm"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(hostShm))
|
Expect(session.OutputToString()).To(Equal(hostShm))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run ipcns ipcmk host test", func() {
|
It("podman run ipcns ipcmk host test", func() {
|
||||||
setup := SystemExec("ipcmk", []string{"-M", "1024"})
|
setup := SystemExec("ipcmk", []string{"-M", "1024"})
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(ExitCleanly())
|
||||||
output := strings.Split(setup.OutputToString(), " ")
|
output := strings.Split(setup.OutputToString(), " ")
|
||||||
ipc := output[len(output)-1]
|
ipc := output[len(output)-1]
|
||||||
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ipcs", "-m", "-i", ipc})
|
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ipcs", "-m", "-i", ipc})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
setup = SystemExec("ipcrm", []string{"-m", ipc})
|
setup = SystemExec("ipcrm", []string{"-m", ipc})
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run ipcns ipcmk container test", func() {
|
It("podman run ipcns ipcmk container test", func() {
|
||||||
setup := podmanTest.Podman([]string{"run", "-d", "--name", "test1", fedoraMinimal, "sleep", "999"})
|
setup := podmanTest.Podman([]string{"run", "-d", "--name", "test1", fedoraMinimal, "sleep", "999"})
|
||||||
setup.WaitWithDefaultTimeout()
|
setup.WaitWithDefaultTimeout()
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"exec", "test1", "ipcmk", "-M", "1024"})
|
session := podmanTest.Podman([]string{"exec", "test1", "ipcmk", "-M", "1024"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output := strings.Split(session.OutputToString(), " ")
|
output := strings.Split(session.OutputToString(), " ")
|
||||||
ipc := output[len(output)-1]
|
ipc := output[len(output)-1]
|
||||||
session = podmanTest.Podman([]string{"run", "--ipc=container:test1", fedoraMinimal, "ipcs", "-m", "-i", ipc})
|
session = podmanTest.Podman([]string{"run", "--ipc=container:test1", fedoraMinimal, "ipcs", "-m", "-i", ipc})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run bad ipc pid test", func() {
|
It("podman run bad ipc pid test", func() {
|
||||||
|
|
@ -86,7 +85,7 @@ var _ = Describe("Podman run ns", func() {
|
||||||
It("podman run mounts fresh cgroup", func() {
|
It("podman run mounts fresh cgroup", func() {
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "grep", "cgroup", "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "grep", "cgroup", "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
Expect(output).ToNot(ContainSubstring(".."))
|
Expect(output).ToNot(ContainSubstring(".."))
|
||||||
})
|
})
|
||||||
|
|
@ -107,13 +106,13 @@ var _ = Describe("Podman run ns", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/pid"})
|
session := podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/pid"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
fields = strings.Split(session.OutputToString(), " ")
|
fields = strings.Split(session.OutputToString(), " ")
|
||||||
ctrPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
ctrPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/ipc"})
|
session = podmanTest.Podman([]string{"run", "--ipc=host", "--pid=host", ALPINE, "ls", "-l", "/proc/self/ns/ipc"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
fields = strings.Split(session.OutputToString(), " ")
|
fields = strings.Split(session.OutputToString(), " ")
|
||||||
ctrIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
ctrIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run passwd", func() {
|
var _ = Describe("Podman run passwd", func() {
|
||||||
|
|
@ -14,27 +13,27 @@ var _ = Describe("Podman run passwd", func() {
|
||||||
It("podman run no user specified ", func() {
|
It("podman run no user specified ", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
||||||
})
|
})
|
||||||
It("podman run user specified in container", func() {
|
It("podman run user specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "bin", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "bin", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run UID specified in container", func() {
|
It("podman run UID specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "2:1", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "2:1", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run UID not specified in container", func() {
|
It("podman run UID not specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:1", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:1", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("passwd"))
|
Expect(session.OutputToString()).To(ContainSubstring("passwd"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -46,26 +45,26 @@ USER 1000`, ALPINE)
|
||||||
podmanTest.BuildImage(dockerfile, imgName, "false")
|
podmanTest.BuildImage(dockerfile, imgName, "false")
|
||||||
session := podmanTest.Podman([]string{"run", "--passwd=false", "--rm", imgName, "ls", "/etc/"})
|
session := podmanTest.Podman([]string{"run", "--passwd=false", "--rm", imgName, "ls", "/etc/"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("passwd")))
|
||||||
|
|
||||||
// test that the /etc/passwd file is created
|
// test that the /etc/passwd file is created
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "0:0", imgName, "ls", "/etc/passwd"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "0:0", imgName, "ls", "/etc/passwd"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with no user specified does not change --group specified", func() {
|
It("podman run with no user specified does not change --group specified", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run group specified in container", func() {
|
It("podman run group specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:bin", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:bin", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -78,21 +77,21 @@ USER 1000`, ALPINE)
|
||||||
It("podman run numeric group specified in container", func() {
|
It("podman run numeric group specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:11", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "root:11", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run numeric group not specified in container", func() {
|
It("podman run numeric group not specified in container", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:20001", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001:20001", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/etc/group"))
|
Expect(session.OutputToString()).To(ContainSubstring("/etc/group"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run numeric user not specified in container modifies group", func() {
|
It("podman run numeric user not specified in container modifies group", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--read-only", "-u", "20001", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/etc/group"))
|
Expect(session.OutputToString()).To(ContainSubstring("/etc/group"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -104,19 +103,19 @@ USER 1000`, ALPINE)
|
||||||
podmanTest.BuildImage(dockerfile, imgName, "false")
|
podmanTest.BuildImage(dockerfile, imgName, "false")
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/"})
|
session := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("/etc/group")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run --no-manage-passwd flag", func() {
|
It("podman run --no-manage-passwd flag", func() {
|
||||||
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", ALPINE, "cat", "/etc/passwd"})
|
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", ALPINE, "cat", "/etc/passwd"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring("1234:1234"))
|
Expect(run.OutputToString()).To(ContainSubstring("1234:1234"))
|
||||||
|
|
||||||
run = podmanTest.Podman([]string{"run", "--passwd=false", "--user", "1234:1234", ALPINE, "cat", "/etc/passwd"})
|
run = podmanTest.Podman([]string{"run", "--passwd=false", "--user", "1234:1234", ALPINE, "cat", "/etc/passwd"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).NotTo((ContainSubstring("1234:1234")))
|
Expect(run.OutputToString()).NotTo((ContainSubstring("1234:1234")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -124,11 +123,11 @@ USER 1000`, ALPINE)
|
||||||
// Test that the line we add doesn't contain anything else than what is specified
|
// Test that the line we add doesn't contain anything else than what is specified
|
||||||
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", "--passwd-entry=FOO", ALPINE, "grep", "^FOO$", "/etc/passwd"})
|
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", "--passwd-entry=FOO", ALPINE, "grep", "^FOO$", "/etc/passwd"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
|
|
||||||
run = podmanTest.Podman([]string{"run", "--user", "12345:12346", "-w", "/etc", "--passwd-entry=$UID-$GID-$NAME-$HOME-$USERNAME", ALPINE, "cat", "/etc/passwd"})
|
run = podmanTest.Podman([]string{"run", "--user", "12345:12346", "-w", "/etc", "--passwd-entry=$UID-$GID-$NAME-$HOME-$USERNAME", ALPINE, "cat", "/etc/passwd"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring("12345-12346-container user-/etc-12345"))
|
Expect(run.OutputToString()).To(ContainSubstring("12345-12346-container user-/etc-12345"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -136,11 +135,11 @@ USER 1000`, ALPINE)
|
||||||
// Test that the line we add doesn't contain anything else than what is specified
|
// Test that the line we add doesn't contain anything else than what is specified
|
||||||
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", "--group-entry=FOO", ALPINE, "grep", "^FOO$", "/etc/group"})
|
run := podmanTest.Podman([]string{"run", "--user", "1234:1234", "--group-entry=FOO", ALPINE, "grep", "^FOO$", "/etc/group"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
|
|
||||||
run = podmanTest.Podman([]string{"run", "--user", "12345:12346", "--group-entry=$GID", ALPINE, "tail", "/etc/group"})
|
run = podmanTest.Podman([]string{"run", "--user", "12345:12346", "--group-entry=$GID", ALPINE, "tail", "/etc/group"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).To(ContainSubstring("12346"))
|
Expect(run.OutputToString()).To(ContainSubstring("12346"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
"github.com/syndtr/gocapability/capability"
|
"github.com/syndtr/gocapability/capability"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -40,17 +39,17 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
It("podman privileged make sure sys is mounted rw", func() {
|
It("podman privileged make sure sys is mounted rw", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", BB, "mount"})
|
session := podmanTest.Podman([]string{"run", "--privileged", BB, "mount"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("sysfs (rw,"))
|
Expect(session.OutputToString()).To(ContainSubstring("sysfs (rw,"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman privileged CapEff", func() {
|
It("podman privileged CapEff", func() {
|
||||||
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
Expect(hostCap).Should(Exit(0))
|
Expect(hostCap).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--privileged", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
||||||
})
|
})
|
||||||
|
|
@ -58,11 +57,11 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
It("podman cap-add CapEff", func() {
|
It("podman cap-add CapEff", func() {
|
||||||
// Get caps of current process
|
// Get caps of current process
|
||||||
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
Expect(hostCap).Should(Exit(0))
|
Expect(hostCap).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
||||||
})
|
})
|
||||||
|
|
@ -70,11 +69,11 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
It("podman cap-add CapEff with --user", func() {
|
It("podman cap-add CapEff with --user", func() {
|
||||||
// Get caps of current process
|
// Get caps of current process
|
||||||
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
hostCap := SystemExec("awk", []string{"/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
Expect(hostCap).Should(Exit(0))
|
Expect(hostCap).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--user=bin", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--user=bin", "--cap-add", "all", BB, "awk", "/^CapEff/ { print $2 }", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
containerCapMatchesHost(session.OutputToString(), hostCap.OutputToString())
|
||||||
})
|
})
|
||||||
|
|
@ -82,31 +81,31 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
It("podman cap-drop CapEff", func() {
|
It("podman cap-drop CapEff", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--cap-drop", "all", BB, "grep", "CapEff", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--cap-drop", "all", BB, "grep", "CapEff", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
capEff := strings.Split(session.OutputToString(), " ")
|
capEff := strings.Split(session.OutputToString(), " ")
|
||||||
Expect("0000000000000000").To(Equal(capEff[1]))
|
Expect("0000000000000000").To(Equal(capEff[1]))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman privileged should disable seccomp by default", func() {
|
It("podman privileged should disable seccomp by default", func() {
|
||||||
hostSeccomp := SystemExec("grep", []string{"-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
hostSeccomp := SystemExec("grep", []string{"-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
||||||
Expect(hostSeccomp).Should(Exit(0))
|
Expect(hostSeccomp).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "grep", "-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "grep", "-Ei", "^Seccomp:\\s+0$", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman non-privileged should have very few devices", func() {
|
It("podman non-privileged should have very few devices", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-t", BB, "ls", "-l", "/dev"})
|
session := podmanTest.Podman([]string{"run", "-t", BB, "ls", "-l", "/dev"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(17))
|
Expect(session.OutputToStringArray()).To(HaveLen(17))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman privileged should inherit host devices", func() {
|
It("podman privileged should inherit host devices", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "-l", "/dev"})
|
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "-l", "/dev"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 20))
|
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 20))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -120,18 +119,18 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
|
|
||||||
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
mknod := SystemExec("mknod", []string{devdir + "/null", "c", "1", "3"})
|
||||||
mknod.WaitWithDefaultTimeout()
|
mknod.WaitWithDefaultTimeout()
|
||||||
Expect(mknod).Should(Exit(0))
|
Expect(mknod).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--name=" + containerName, "--privileged", fedoraMinimal, "ls", "/dev"})
|
session := podmanTest.Podman([]string{"run", "--name=" + containerName, "--privileged", fedoraMinimal, "ls", "/dev"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
deviceFiles := session.OutputToStringArray()
|
deviceFiles := session.OutputToStringArray()
|
||||||
|
|
||||||
os.RemoveAll(devdir)
|
os.RemoveAll(devdir)
|
||||||
session = podmanTest.Podman([]string{"start", "--attach", containerName})
|
session = podmanTest.Podman([]string{"start", "--attach", containerName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
deviceFilesAfterRemoval := session.OutputToStringArray()
|
deviceFilesAfterRemoval := session.OutputToStringArray()
|
||||||
Expect(deviceFiles).To(Not(Equal(deviceFilesAfterRemoval)))
|
Expect(deviceFiles).To(Not(Equal(deviceFilesAfterRemoval)))
|
||||||
|
|
@ -152,12 +151,12 @@ var _ = Describe("Podman privileged container tests", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", BB, "grep", "NoNewPrivs", "/proc/self/status"})
|
session := podmanTest.Podman([]string{"run", BB, "grep", "NoNewPrivs", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
privs := strings.Split(session.OutputToString(), ":")
|
privs := strings.Split(session.OutputToString(), ":")
|
||||||
session = podmanTest.Podman([]string{"run", "--security-opt", "no-new-privileges", BB, "grep", "NoNewPrivs", "/proc/self/status"})
|
session = podmanTest.Podman([]string{"run", "--security-opt", "no-new-privileges", BB, "grep", "NoNewPrivs", "/proc/self/status"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
noprivs := strings.Split(session.OutputToString(), ":")
|
noprivs := strings.Split(session.OutputToString(), ":")
|
||||||
Expect(privs[1]).To(Not(Equal(noprivs[1])))
|
Expect(privs[1]).To(Not(Equal(noprivs[1])))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run restart containers", func() {
|
var _ = Describe("Podman run restart containers", func() {
|
||||||
|
|
@ -12,15 +11,15 @@ var _ = Describe("Podman run restart containers", func() {
|
||||||
It("Podman start after successful run", func() {
|
It("Podman start after successful run", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"run", "--name", "test", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"wait", "test"})
|
session = podmanTest.Podman([]string{"wait", "test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session2 := podmanTest.Podman([]string{"start", "--attach", "test"})
|
session2 := podmanTest.Podman([]string{"start", "--attach", "test"})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Podman start after signal kill", func() {
|
It("Podman start after signal kill", func() {
|
||||||
|
|
@ -30,10 +29,10 @@ var _ = Describe("Podman run restart containers", func() {
|
||||||
|
|
||||||
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
|
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test1"})
|
||||||
killSession.WaitWithDefaultTimeout()
|
killSession.WaitWithDefaultTimeout()
|
||||||
Expect(killSession).Should(Exit(0))
|
Expect(killSession).Should(ExitCleanly())
|
||||||
|
|
||||||
session2 := podmanTest.Podman([]string{"start", "test1"})
|
session2 := podmanTest.Podman([]string{"start", "test1"})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,16 @@ import (
|
||||||
var _ = Describe("Podman run", func() {
|
var _ = Describe("Podman run", func() {
|
||||||
|
|
||||||
It("podman run --seccomp-policy default", func() {
|
It("podman run --seccomp-policy default", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "default", alpineSeccomp, "ls"})
|
session := podmanTest.Podman([]string{"run", "-q", "--seccomp-policy", "default", alpineSeccomp, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run --seccomp-policy ''", func() {
|
It("podman run --seccomp-policy ''", func() {
|
||||||
// Empty string is interpreted as "default".
|
// Empty string is interpreted as "default".
|
||||||
session := podmanTest.Podman([]string{"run", "--seccomp-policy", "", alpineSeccomp, "ls"})
|
session := podmanTest.Podman([]string{"run", "-q", "--seccomp-policy", "", alpineSeccomp, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run --seccomp-policy invalid", func() {
|
It("podman run --seccomp-policy invalid", func() {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -20,105 +21,105 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman run selinux", func() {
|
It("podman run selinux", func() {
|
||||||
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run selinux grep test", func() {
|
It("podman run selinux grep test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2"))
|
Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run selinux disable test", func() {
|
It("podman run selinux disable test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run selinux type check test", func() {
|
It("podman run selinux type check test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Or(ContainSubstring("container_t"), ContainSubstring("svirt_lxc_net_t")))
|
Expect(session.OutputToString()).To(Or(ContainSubstring("container_t"), ContainSubstring("svirt_lxc_net_t")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run selinux type setup test", func() {
|
It("podman run selinux type setup test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman privileged selinux", func() {
|
It("podman privileged selinux", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux label resolv.conf", func() {
|
It("podman test selinux label resolv.conf", func() {
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux label hosts", func() {
|
It("podman test selinux label hosts", func() {
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux label hostname", func() {
|
It("podman test selinux label hostname", func() {
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux label /run/secrets", func() {
|
It("podman test selinux label /run/secrets", func() {
|
||||||
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
|
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux --privileged label resolv.conf", func() {
|
It("podman test selinux --privileged label resolv.conf", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
|
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/resolv.conf"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux --privileged label hosts", func() {
|
It("podman test selinux --privileged label hosts", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
|
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hosts"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux --privileged label hostname", func() {
|
It("podman test selinux --privileged label hostname", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
|
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-Z", "/etc/hostname"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test selinux --privileged label /run/secrets", func() {
|
It("podman test selinux --privileged label /run/secrets", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
|
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_file_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run selinux file type setup test", func() {
|
It("podman run selinux file type setup test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:container_var_lib_t", fedoraMinimal, "ls", "-Z", "/dev"})
|
session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:container_var_lib_t", fedoraMinimal, "ls", "-Z", "/dev"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_var_lib_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_var_lib_t"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:foobar", fedoraMinimal, "ls", "-Z", "/dev"})
|
session = podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:foobar", fedoraMinimal, "ls", "-Z", "/dev"})
|
||||||
|
|
@ -129,7 +130,7 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman exec selinux check", func() {
|
It("podman exec selinux check", func() {
|
||||||
setup := podmanTest.RunTopContainer("test1")
|
setup := podmanTest.RunTopContainer("test1")
|
||||||
setup.WaitWithDefaultTimeout()
|
setup.WaitWithDefaultTimeout()
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(ExitCleanly())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/1/attr/current"})
|
session := podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/1/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -141,7 +142,7 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman run --privileged and --security-opt SELinux options", func() {
|
It("podman run --privileged and --security-opt SELinux options", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--privileged", "--security-opt", "label=type:spc_t", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--privileged", "--security-opt", "label=type:spc_t", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2"))
|
Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2"))
|
||||||
})
|
})
|
||||||
|
|
@ -149,90 +150,90 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman pod container share SELinux labels", func() {
|
It("podman pod container share SELinux labels", func() {
|
||||||
session := podmanTest.Podman([]string{"pod", "create"})
|
session := podmanTest.Podman([]string{"pod", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
podID := session.OutputToString()
|
podID := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
label1 := session.OutputToString()
|
label1 := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(label1))
|
Expect(session.OutputToString()).To(Equal(label1))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", podID, "--force"})
|
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", podID, "--force"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pod container --infra=false doesn't share SELinux labels", func() {
|
It("podman pod container --infra=false doesn't share SELinux labels", func() {
|
||||||
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
|
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
podID := session.OutputToString()
|
podID := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
label1 := session.OutputToString()
|
label1 := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--pod", podID, ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(Equal(label1)))
|
Expect(session.OutputToString()).To(Not(Equal(label1)))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", podID, "--force"})
|
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", podID, "--force"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman shared IPC NS container share SELinux labels", func() {
|
It("podman shared IPC NS container share SELinux labels", func() {
|
||||||
session := podmanTest.RunTopContainer("test1")
|
session := podmanTest.RunTopContainer("test1")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
label1 := session.OutputToString()
|
label1 := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--ipc", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--ipc", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(label1))
|
Expect(session.OutputToString()).To(Equal(label1))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman shared PID NS container share SELinux labels", func() {
|
It("podman shared PID NS container share SELinux labels", func() {
|
||||||
session := podmanTest.RunTopContainer("test1")
|
session := podmanTest.RunTopContainer("test1")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
label1 := session.OutputToString()
|
label1 := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--pid", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--pid", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(label1))
|
Expect(session.OutputToString()).To(Equal(label1))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman shared NET NS container doesn't share SELinux labels", func() {
|
It("podman shared NET NS container doesn't share SELinux labels", func() {
|
||||||
session := podmanTest.RunTopContainer("test1")
|
session := podmanTest.RunTopContainer("test1")
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"exec", "test1", "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
label1 := session.OutputToString()
|
label1 := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--net", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
session = podmanTest.Podman([]string{"run", "--net", "container:test1", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(Equal(label1)))
|
Expect(session.OutputToString()).To(Not(Equal(label1)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -240,35 +241,35 @@ var _ = Describe("Podman run", func() {
|
||||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||||
session := podmanTest.Podman([]string{"run", "--pid=host", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--pid=host", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test --ipc=host", func() {
|
It("podman test --ipc=host", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--ipc=host", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--ipc=host", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test --ipc=net", func() {
|
It("podman test --ipc=net", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test --ipc=net", func() {
|
It("podman test --ipc=net", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman test --ipc=net", func() {
|
It("podman test --ipc=net", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
session := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/proc/self/attr/current"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
Expect(session.OutputToString()).To(ContainSubstring("container_t"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -283,7 +284,7 @@ var _ = Describe("Podman run", func() {
|
||||||
}
|
}
|
||||||
session := podmanTest.Podman([]string{"create", ALPINE})
|
session := podmanTest.Podman([]string{"create", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
|
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -299,7 +300,7 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman test init labels", func() {
|
It("podman test init labels", func() {
|
||||||
session := podmanTest.Podman([]string{"create", SYSTEMD_IMAGE, "/sbin/init"})
|
session := podmanTest.Podman([]string{"create", SYSTEMD_IMAGE, "/sbin/init"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
|
session = podmanTest.Podman([]string{"inspect", "--format", "{{ .ProcessLabel }}", cid})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -309,7 +310,7 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman relabels named volume with :Z", func() {
|
It("podman relabels named volume with :Z", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-v", "testvol:/test1/test:Z", fedoraMinimal, "ls", "-alZ", "/test1"})
|
session := podmanTest.Podman([]string{"run", "-v", "testvol:/test1/test:Z", fedoraMinimal, "ls", "-alZ", "/test1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(":s0:"))
|
Expect(session.OutputToString()).To(ContainSubstring(":s0:"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -108,7 +107,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
|
||||||
// Kill with -9 to guarantee the container dies
|
// Kill with -9 to guarantee the container dies
|
||||||
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test2"})
|
killSession := podmanTest.Podman([]string{"kill", "-s", "9", "test2"})
|
||||||
killSession.WaitWithDefaultTimeout()
|
killSession.WaitWithDefaultTimeout()
|
||||||
Expect(killSession).Should(Exit(0))
|
Expect(killSession).Should(ExitCleanly())
|
||||||
|
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(ExitWithError())
|
Expect(session).To(ExitWithError())
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/containers/storage/pkg/stringid"
|
"github.com/containers/storage/pkg/stringid"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run with --ip flag", func() {
|
var _ = Describe("Podman run with --ip flag", func() {
|
||||||
|
|
@ -40,7 +39,7 @@ var _ = Describe("Podman run with --ip flag", func() {
|
||||||
ip := GetSafeIPAddress()
|
ip := GetSafeIPAddress()
|
||||||
result := podmanTest.Podman([]string{"run", "--ip", ip, ALPINE, "ip", "addr"})
|
result := podmanTest.Podman([]string{"run", "--ip", ip, ALPINE, "ip", "addr"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -50,11 +49,11 @@ var _ = Describe("Podman run with --ip flag", func() {
|
||||||
net := podmanTest.Podman([]string{"network", "create", "--subnet", "fd46:db93:aa76:ac37::/64", netName})
|
net := podmanTest.Podman([]string{"network", "create", "--subnet", "fd46:db93:aa76:ac37::/64", netName})
|
||||||
net.WaitWithDefaultTimeout()
|
net.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(net).To(Exit(0))
|
Expect(net).To(ExitCleanly())
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{"run", "--network", netName, "--ip6", ipv6, ALPINE, "ip", "addr"})
|
result := podmanTest.Podman([]string{"run", "--network", netName, "--ip6", ipv6, ALPINE, "ip", "addr"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(ipv6 + "/64"))
|
Expect(result.OutputToString()).To(ContainSubstring(ipv6 + "/64"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -62,7 +61,7 @@ var _ = Describe("Podman run with --ip flag", func() {
|
||||||
ip := GetSafeIPAddress()
|
ip := GetSafeIPAddress()
|
||||||
result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip, ALPINE, "ip", "addr"})
|
result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip, ALPINE, "ip", "addr"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -72,7 +71,7 @@ var _ = Describe("Podman run with --ip flag", func() {
|
||||||
intName := "myeth"
|
intName := "myeth"
|
||||||
result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip + ",mac=" + mac + ",interface_name=" + intName, ALPINE, "ip", "addr"})
|
result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip + ",mac=" + mac + ",interface_name=" + intName, ALPINE, "ip", "addr"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(mac))
|
Expect(result.OutputToString()).To(ContainSubstring(mac))
|
||||||
Expect(result.OutputToString()).To(ContainSubstring(intName))
|
Expect(result.OutputToString()).To(ContainSubstring(intName))
|
||||||
|
|
@ -82,7 +81,7 @@ var _ = Describe("Podman run with --ip flag", func() {
|
||||||
ip := GetSafeIPAddress()
|
ip := GetSafeIPAddress()
|
||||||
result := podmanTest.Podman([]string{"run", "-d", "--name", "nginx", "--ip", ip, NGINX_IMAGE})
|
result := podmanTest.Podman([]string{"run", "-d", "--name", "nginx", "--ip", ip, NGINX_IMAGE})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
|
|
||||||
// This test should not use a proxy
|
// This test should not use a proxy
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman run with volumes", func() {
|
var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
@ -27,7 +26,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
It("podman run with no transient-store", func() {
|
It("podman run with no transient-store", func() {
|
||||||
session := podmanTest.Podman([]string{"run", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
_ = SystemExec("ls", []string{"-l", containerStorageDir})
|
_ = SystemExec("ls", []string{"-l", containerStorageDir})
|
||||||
|
|
||||||
|
|
@ -49,7 +48,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
It("podman run --rm with no transient-store", func() {
|
It("podman run --rm with no transient-store", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// All files should not be in permanent store, not volatile
|
// All files should not be in permanent store, not volatile
|
||||||
Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
|
Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
|
||||||
|
|
@ -70,7 +69,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
SkipIfRemote("Can't change store options remotely")
|
SkipIfRemote("Can't change store options remotely")
|
||||||
session := podmanTest.Podman([]string{"run", "--transient-store", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "--transient-store", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// All files should be in runroot store, volatile
|
// All files should be in runroot store, volatile
|
||||||
Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
|
Expect(filepath.Join(containerStorageDir, "containers.json")).Should(Not(BeAnExistingFile()))
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
@ -57,7 +58,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
}
|
}
|
||||||
session := podmanTest.Podman([]string{"build", "-f", "build/Containerfile.userns-auto", "-t", "test", "--userns=auto"})
|
session := podmanTest.Podman([]string{"build", "-f", "build/Containerfile.userns-auto", "-t", "test", "--userns=auto"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
// `1024` is the default size or length of the range of user IDs
|
// `1024` is the default size or length of the range of user IDs
|
||||||
// that is mapped between the two user namespaces by --userns=auto.
|
// that is mapped between the two user namespaces by --userns=auto.
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(fmt.Sprintf("%d", storage.AutoUserNsMinSize)))
|
Expect(session.OutputToString()).To(ContainSubstring(fmt.Sprintf("%d", storage.AutoUserNsMinSize)))
|
||||||
|
|
@ -66,7 +67,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
It("podman uidmapping and gidmapping", func() {
|
It("podman uidmapping and gidmapping", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--uidmap=0:100:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--uidmap=0:100:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -77,14 +78,14 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
It("podman uidmapping and gidmapping with short-opts", func() {
|
It("podman uidmapping and gidmapping with short-opts", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman uidmapping and gidmapping with a volume", func() {
|
It("podman uidmapping and gidmapping with a volume", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:500", "--gidmap=0:200:5000", "-v", "my-foo-volume:/foo:Z", "alpine", "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:500", "--gidmap=0:200:5000", "-v", "my-foo-volume:/foo:Z", "alpine", "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -99,14 +100,14 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
if strings.Contains(session.ErrorToString(), "Invalid argument") {
|
if strings.Contains(session.ErrorToString(), "Invalid argument") {
|
||||||
Skip("the file system doesn't support idmapped mounts")
|
Skip("the file system doesn't support idmapped mounts")
|
||||||
}
|
}
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("#0:0#"))
|
Expect(session.OutputToString()).To(ContainSubstring("#0:0#"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman uidmapping and gidmapping --net=host", func() {
|
It("podman uidmapping and gidmapping --net=host", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--net=host", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--net=host", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
Expect(session.OutputToString()).To(ContainSubstring("hello"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -114,21 +115,21 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-u"})
|
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-u"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
uid := fmt.Sprintf("%d", os.Geteuid())
|
uid := fmt.Sprintf("%d", os.Geteuid())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(uid))
|
Expect(session.OutputToString()).To(ContainSubstring(uid))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=keep-id:uid=10,gid=12", "alpine", "sh", "-c", "echo $(id -u):$(id -g)"})
|
session = podmanTest.Podman([]string{"run", "--userns=keep-id:uid=10,gid=12", "alpine", "sh", "-c", "echo $(id -u):$(id -g)"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("10:12"))
|
Expect(session.OutputToString()).To(ContainSubstring("10:12"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman --userns=keep-id check passwd", func() {
|
It("podman --userns=keep-id check passwd", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-un"})
|
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "id", "-un"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
u, err := user.Current()
|
u, err := user.Current()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(session.OutputToString()).To(Equal(u.Username))
|
Expect(session.OutputToString()).To(Equal(u.Username))
|
||||||
|
|
@ -137,14 +138,14 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
It("podman --userns=keep-id root owns /usr", func() {
|
It("podman --userns=keep-id root owns /usr", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "stat", "-c%u", "/usr"})
|
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "alpine", "stat", "-c%u", "/usr"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("0"))
|
Expect(session.OutputToString()).To(Equal("0"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman --userns=keep-id --user root:root", func() {
|
It("podman --userns=keep-id --user root:root", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "alpine", "id", "-u"})
|
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "alpine", "id", "-u"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("0"))
|
Expect(session.OutputToString()).To(Equal("0"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -157,16 +158,16 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
ctrName := "ctr-name"
|
ctrName := "ctr-name"
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "-d", "--stop-signal", "9", "--name", ctrName, fedoraMinimal, "sleep", "600"})
|
session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", "-d", "--stop-signal", "9", "--name", ctrName, fedoraMinimal, "sleep", "600"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
exec1 := podmanTest.Podman([]string{"exec", ctrName, "cat", "/etc/passwd"})
|
exec1 := podmanTest.Podman([]string{"exec", ctrName, "cat", "/etc/passwd"})
|
||||||
exec1.WaitWithDefaultTimeout()
|
exec1.WaitWithDefaultTimeout()
|
||||||
Expect(exec1).Should(Exit(0))
|
Expect(exec1).Should(ExitCleanly())
|
||||||
Expect(exec1.OutputToString()).To(ContainSubstring(userName))
|
Expect(exec1.OutputToString()).To(ContainSubstring(userName))
|
||||||
|
|
||||||
exec2 := podmanTest.Podman([]string{"exec", ctrName, "useradd", "testuser"})
|
exec2 := podmanTest.Podman([]string{"exec", ctrName, "useradd", "testuser"})
|
||||||
exec2.WaitWithDefaultTimeout()
|
exec2.WaitWithDefaultTimeout()
|
||||||
Expect(exec2).Should(Exit(0))
|
Expect(exec2).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman --userns=auto", func() {
|
It("podman --userns=auto", func() {
|
||||||
|
|
@ -189,7 +190,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=auto", "alpine", "cat", "/proc/self/uid_map"})
|
session := podmanTest.Podman([]string{"run", "--userns=auto", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
l := session.OutputToString()
|
l := session.OutputToString()
|
||||||
// `1024` is the default size or length of the range of user IDs
|
// `1024` is the default size or length of the range of user IDs
|
||||||
// that is mapped between the two user namespaces by --userns=auto.
|
// that is mapped between the two user namespaces by --userns=auto.
|
||||||
|
|
@ -202,7 +203,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
createContainersConfFileWithCustomUserns(podmanTest, "auto:size=1019")
|
createContainersConfFileWithCustomUserns(podmanTest, "auto:size=1019")
|
||||||
session := podmanTest.Podman([]string{"run", "alpine", "cat", "/proc/self/uid_map"})
|
session := podmanTest.Podman([]string{"run", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("1019"))
|
Expect(session.OutputToString()).To(ContainSubstring("1019"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -225,22 +226,22 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=auto:size=500", "alpine", "cat", "/proc/self/uid_map"})
|
session := podmanTest.Podman([]string{"run", "--userns=auto:size=500", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("500"))
|
Expect(session.OutputToString()).To(ContainSubstring("500"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=auto:size=3000", "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--userns=auto:size=3000", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("3000"))
|
Expect(session.OutputToString()).To(ContainSubstring("3000"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=2000:3000", "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=2000:3000", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("3001"))
|
Expect(session.OutputToString()).To(ContainSubstring("3001"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=4000:1000", "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=4000:1000", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("4001"))
|
Expect(session.OutputToString()).To(ContainSubstring("4001"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -263,13 +264,13 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=auto:uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
|
session := podmanTest.Podman([]string{"run", "--userns=auto:uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
|
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,uidmapping=0:0:1", "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("8191"))
|
Expect(session.OutputToString()).To(ContainSubstring("8191"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -292,13 +293,13 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--userns=auto:gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
|
session := podmanTest.Podman([]string{"run", "--userns=auto:gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
|
Expect(output).To(MatchRegexp("\\s0\\s0\\s1"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
|
session = podmanTest.Podman([]string{"run", "--userns=auto:size=8192,gidmapping=0:0:1", "alpine", "cat", "/proc/self/gid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("8191"))
|
Expect(session.OutputToString()).To(ContainSubstring("8191"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -306,18 +307,18 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
ctrName := "userns-ctr"
|
ctrName := "userns-ctr"
|
||||||
session := podmanTest.Podman([]string{"run", "-d", "--uidmap=0:0:1", "--uidmap=1:2:4998", "--name", ctrName, "alpine", "top"})
|
session := podmanTest.Podman([]string{"run", "-d", "--uidmap=0:0:1", "--uidmap=1:2:4998", "--name", ctrName, "alpine", "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// runc has an issue and we also need to join the IPC namespace.
|
// runc has an issue and we also need to join the IPC namespace.
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--ipc=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--ipc=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("4998"))
|
Expect(session.OutputToString()).To(ContainSubstring("4998"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--net=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--userns=container:" + ctrName, "--net=container:" + ctrName, "alpine", "cat", "/proc/self/uid_map"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("4998"))
|
Expect(session.OutputToString()).To(ContainSubstring("4998"))
|
||||||
})
|
})
|
||||||
|
|
@ -334,17 +335,17 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
session := podmanTest.Podman([]string{"run", "-d", "--user", tt.arg, "--mount", "type=volume,src=" + tt.vol + ",dst=/home/user", "alpine", "top"})
|
session := podmanTest.Podman([]string{"run", "-d", "--user", tt.arg, "--mount", "type=volume,src=" + tt.vol + ",dst=/home/user", "alpine", "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", tt.vol})
|
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", tt.vol})
|
||||||
inspectUID.WaitWithDefaultTimeout()
|
inspectUID.WaitWithDefaultTimeout()
|
||||||
Expect(inspectUID).Should(Exit(0))
|
Expect(inspectUID).Should(ExitCleanly())
|
||||||
Expect(inspectUID.OutputToString()).To(Equal(tt.uid))
|
Expect(inspectUID.OutputToString()).To(Equal(tt.uid))
|
||||||
|
|
||||||
// Make sure we're defaulting to 0.
|
// Make sure we're defaulting to 0.
|
||||||
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", tt.vol})
|
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", tt.vol})
|
||||||
inspectGID.WaitWithDefaultTimeout()
|
inspectGID.WaitWithDefaultTimeout()
|
||||||
Expect(inspectGID).Should(Exit(0))
|
Expect(inspectGID).Should(ExitCleanly())
|
||||||
Expect(inspectGID.OutputToString()).To(Equal(tt.gid))
|
Expect(inspectGID.OutputToString()).To(Equal(tt.gid))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,11 +367,11 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
// In any case, make sure the command doesn't succeed.
|
// In any case, make sure the command doesn't succeed.
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=private", "--subuidname=containers", "alpine", "true"})
|
session = podmanTest.Podman([]string{"run", "--userns=private", "--subuidname=containers", "alpine", "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Not(Exit(0)))
|
Expect(session).Should(Not(ExitCleanly()))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--userns=private", "--subgidname=containers", "alpine", "true"})
|
session = podmanTest.Podman([]string{"run", "--userns=private", "--subgidname=containers", "alpine", "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Not(Exit(0)))
|
Expect(session).Should(Not(ExitCleanly()))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman PODMAN_USERNS", func() {
|
It("podman PODMAN_USERNS", func() {
|
||||||
|
|
@ -389,7 +390,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{"create", ALPINE, "true"})
|
result := podmanTest.Podman([]string{"create", ALPINE, "true"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
|
|
||||||
inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.IDMappings }}", result.OutputToString()})
|
inspect := podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.IDMappings }}", result.OutputToString()})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
|
|
@ -398,7 +399,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||||
// --pod should work.
|
// --pod should work.
|
||||||
result = podmanTest.Podman([]string{"create", "--pod=new:new-pod", ALPINE, "true"})
|
result = podmanTest.Podman([]string{"create", "--pod=new:new-pod", ALPINE, "true"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(ExitCleanly())
|
||||||
|
|
||||||
if IsRemote() {
|
if IsRemote() {
|
||||||
podmanTest.RestartRemoteService()
|
podmanTest.RestartRemoteService()
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
containerDir := strings.SplitN(volume, ":", 3)[1]
|
containerDir := strings.SplitN(volume, ":", 3)[1]
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "-v", volume, ALPINE, "awk", fmt.Sprintf(`$5 == "%s" { print }`, containerDir), "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", "-v", volume, ALPINE, "awk", fmt.Sprintf(`$5 == "%s" { print }`, containerDir), "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(containerDir), "mount point not found in /proc/self/mountinfo")
|
Expect(session.OutputToString()).To(ContainSubstring(containerDir), "mount point not found in /proc/self/mountinfo")
|
||||||
return strings.Fields(session.OutputToString())
|
return strings.Fields(session.OutputToString())
|
||||||
}
|
}
|
||||||
|
|
@ -66,33 +66,33 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount, ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount, ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",readonly", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",readonly", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",consistency=delegated,shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",consistency=delegated,shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("rw"))
|
Expect(session.OutputToString()).To(ContainSubstring("rw"))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("shared"))
|
Expect(session.OutputToString()).To(ContainSubstring("shared"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=" + dest, ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=" + dest, ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw,nosuid,nodev,relatime - tmpfs"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw,nosuid,nodev,relatime - tmpfs"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("certs"))
|
Expect(session.OutputToString()).To(ContainSubstring("certs"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
||||||
|
|
@ -102,7 +102,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
// test csv escaping
|
// test csv escaping
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount=type=tmpfs,tmpfs-size=512M,\"destination=/test,\"", ALPINE, "ls", "/test,"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount=type=tmpfs,tmpfs-size=512M,\"destination=/test,\"", ALPINE, "ls", "/test,"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=bind,src=/tmp,target=/tmp,tmpcopyup", ALPINE, "true"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=bind,src=/tmp,target=/tmp,tmpcopyup", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -114,7 +114,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,notmpcopyup", ALPINE, "ls", "/etc/ssl"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("certs")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("certs")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/data:Z", mountPath), REDIS_IMAGE, "ls", "/data/test1"})
|
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/data:Z", mountPath), REDIS_IMAGE, "ls", "/data/test1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with mount flag and boolean options", func() {
|
It("podman run with mount flag and boolean options", func() {
|
||||||
|
|
@ -151,12 +151,12 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " rw"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true,rw=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",ro=true,rw=false", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
|
|
@ -167,7 +167,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
It("podman run with volume flag and multiple named volumes", func() {
|
It("podman run with volume flag and multiple named volumes", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/testvol1", "-v", "testvol2:/testvol2", ALPINE, "grep", "/testvol", "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/testvol1", "-v", "testvol2:/testvol2", ALPINE, "grep", "/testvol", "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/testvol1"))
|
Expect(session.OutputToString()).To(ContainSubstring("/testvol1"))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/testvol2"))
|
Expect(session.OutputToString()).To(ContainSubstring("/testvol2"))
|
||||||
})
|
})
|
||||||
|
|
@ -180,7 +180,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":" + dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":" + dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output := session.OutputToString()
|
output := session.OutputToString()
|
||||||
Expect(output).To(Not(ContainSubstring("noexec")))
|
Expect(output).To(Not(ContainSubstring("noexec")))
|
||||||
Expect(output).To(Not(ContainSubstring("nodev")))
|
Expect(output).To(Not(ContainSubstring("nodev")))
|
||||||
|
|
@ -188,7 +188,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--tmpfs", dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"run", "--rm", "--tmpfs", dest + ":suid,dev,exec", ALPINE, "grep", dest, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
output = session.OutputToString()
|
output = session.OutputToString()
|
||||||
Expect(output).To(Not(ContainSubstring("noexec")))
|
Expect(output).To(Not(ContainSubstring("noexec")))
|
||||||
Expect(output).To(Not(ContainSubstring("nodev")))
|
Expect(output).To(Not(ContainSubstring("nodev")))
|
||||||
|
|
@ -213,7 +213,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
// Container should be able to start with custom overlay volume
|
// Container should be able to start with custom overlay volume
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":/data:O", "--workdir=/data", ALPINE, "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--rm", "-v", mountPath + ":/data:O", "--workdir=/data", ALPINE, "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman support overlay on named volume", func() {
|
It("podman support overlay on named volume", func() {
|
||||||
|
|
@ -229,17 +229,17 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvolume"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvolume"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// create file on actual volume
|
// create file on actual volume
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// create file on overlay volume
|
// create file on overlay volume
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O", ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O", ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// volume should contain only `test` not `overlay`
|
// volume should contain only `test` not `overlay`
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "ls /data"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "ls /data"})
|
||||||
|
|
@ -275,17 +275,17 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvolume"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvolume"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// create file on actual volume
|
// create file on actual volume
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// create file on overlay volume
|
// create file on overlay volume
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "ls /data"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "ls /data"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -334,7 +334,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
// create file on overlay volume
|
// create file on overlay volume
|
||||||
session := podmanTest.Podman([]string{"run", "--volume", bindSource + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
session := podmanTest.Podman([]string{"run", "--volume", bindSource + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "echo hello >> " + "/data/overlay"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", bindSource + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "ls /data"})
|
session = podmanTest.Podman([]string{"run", "--volume", bindSource + ":/data:O," + overlayOpts, ALPINE, "sh", "-c", "ls /data"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -360,7 +360,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
volName := "testvol"
|
volName := "testvol"
|
||||||
mkVolume := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=nodev", "testvol"})
|
mkVolume := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=nodev", "testvol"})
|
||||||
mkVolume.WaitWithDefaultTimeout()
|
mkVolume.WaitWithDefaultTimeout()
|
||||||
Expect(mkVolume).Should(Exit(0))
|
Expect(mkVolume).Should(ExitCleanly())
|
||||||
|
|
||||||
// Volume not mounted on create
|
// Volume not mounted on create
|
||||||
mountCmd1, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
mountCmd1, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||||
|
|
@ -374,7 +374,7 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
ctrName := "testctr"
|
ctrName := "testctr"
|
||||||
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
|
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
|
||||||
podmanSession.WaitWithDefaultTimeout()
|
podmanSession.WaitWithDefaultTimeout()
|
||||||
Expect(podmanSession).Should(Exit(0))
|
Expect(podmanSession).Should(ExitCleanly())
|
||||||
|
|
||||||
// Volume now mounted as container is running
|
// Volume now mounted as container is running
|
||||||
mountCmd2, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
mountCmd2, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||||
|
|
@ -388,12 +388,12 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
// Stop the container to unmount
|
// Stop the container to unmount
|
||||||
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
|
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
|
||||||
podmanStopSession.WaitWithDefaultTimeout()
|
podmanStopSession.WaitWithDefaultTimeout()
|
||||||
Expect(podmanStopSession).Should(Exit(0))
|
Expect(podmanStopSession).Should(ExitCleanly())
|
||||||
|
|
||||||
// We have to force cleanup so the unmount happens
|
// We have to force cleanup so the unmount happens
|
||||||
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", ctrName})
|
podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", ctrName})
|
||||||
podmanCleanupSession.WaitWithDefaultTimeout()
|
podmanCleanupSession.WaitWithDefaultTimeout()
|
||||||
Expect(podmanCleanupSession).Should(Exit(0))
|
Expect(podmanCleanupSession).Should(ExitCleanly())
|
||||||
|
|
||||||
// Ensure volume is unmounted
|
// Ensure volume is unmounted
|
||||||
mountCmd3, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
mountCmd3, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||||
|
|
@ -408,26 +408,26 @@ var _ = Describe("Podman run with volumes", func() {
|
||||||
It("podman named volume copyup", func() {
|
It("podman named volume copyup", func() {
|
||||||
baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/etc/apk/"})
|
baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/etc/apk/"})
|
||||||
baselineSession.WaitWithDefaultTimeout()
|
baselineSession.WaitWithDefaultTimeout()
|
||||||
Expect(baselineSession).Should(Exit(0))
|
Expect(baselineSession).Should(ExitCleanly())
|
||||||
baselineOutput := baselineSession.OutputToString()
|
baselineOutput := baselineSession.OutputToString()
|
||||||
|
|
||||||
inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"})
|
inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"})
|
||||||
inlineVolumeSession.WaitWithDefaultTimeout()
|
inlineVolumeSession.WaitWithDefaultTimeout()
|
||||||
Expect(inlineVolumeSession).Should(Exit(0))
|
Expect(inlineVolumeSession).Should(ExitCleanly())
|
||||||
Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput))
|
Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput))
|
||||||
|
|
||||||
makeVolumeSession := podmanTest.Podman([]string{"volume", "create", "testvol2"})
|
makeVolumeSession := podmanTest.Podman([]string{"volume", "create", "testvol2"})
|
||||||
makeVolumeSession.WaitWithDefaultTimeout()
|
makeVolumeSession.WaitWithDefaultTimeout()
|
||||||
Expect(makeVolumeSession).Should(Exit(0))
|
Expect(makeVolumeSession).Should(ExitCleanly())
|
||||||
|
|
||||||
separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"})
|
separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"})
|
||||||
separateVolumeSession.WaitWithDefaultTimeout()
|
separateVolumeSession.WaitWithDefaultTimeout()
|
||||||
Expect(separateVolumeSession).Should(Exit(0))
|
Expect(separateVolumeSession).Should(ExitCleanly())
|
||||||
Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
|
Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
|
||||||
|
|
||||||
copySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol3:/etc/apk:copy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"})
|
copySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol3:/etc/apk:copy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"})
|
||||||
copySession.WaitWithDefaultTimeout()
|
copySession.WaitWithDefaultTimeout()
|
||||||
Expect(copySession).Should(Exit(0))
|
Expect(copySession).Should(ExitCleanly())
|
||||||
|
|
||||||
noCopySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol4:/etc/apk:nocopy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"})
|
noCopySession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol4:/etc/apk:nocopy", ALPINE, "stat", "-c", "%h", "/etc/apk/arch"})
|
||||||
noCopySession.WaitWithDefaultTimeout()
|
noCopySession.WaitWithDefaultTimeout()
|
||||||
|
|
@ -443,62 +443,62 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
|
|
||||||
baselineSession := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/apk/"})
|
baselineSession := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/apk/"})
|
||||||
baselineSession.WaitWithDefaultTimeout()
|
baselineSession.WaitWithDefaultTimeout()
|
||||||
Expect(baselineSession).Should(Exit(0))
|
Expect(baselineSession).Should(ExitCleanly())
|
||||||
baselineOutput := baselineSession.OutputToString()
|
baselineOutput := baselineSession.OutputToString()
|
||||||
|
|
||||||
outputSession := podmanTest.Podman([]string{"run", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"})
|
outputSession := podmanTest.Podman([]string{"run", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"})
|
||||||
outputSession.WaitWithDefaultTimeout()
|
outputSession.WaitWithDefaultTimeout()
|
||||||
Expect(outputSession).Should(Exit(0))
|
Expect(outputSession).Should(ExitCleanly())
|
||||||
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman named volume copyup empty directory", func() {
|
It("podman named volume copyup empty directory", func() {
|
||||||
baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/srv"})
|
baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/srv"})
|
||||||
baselineSession.WaitWithDefaultTimeout()
|
baselineSession.WaitWithDefaultTimeout()
|
||||||
Expect(baselineSession).Should(Exit(0))
|
Expect(baselineSession).Should(ExitCleanly())
|
||||||
baselineOutput := baselineSession.OutputToString()
|
baselineOutput := baselineSession.OutputToString()
|
||||||
|
|
||||||
outputSession := podmanTest.Podman([]string{"run", "-v", "/srv", ALPINE, "ls", "/srv"})
|
outputSession := podmanTest.Podman([]string{"run", "-v", "/srv", ALPINE, "ls", "/srv"})
|
||||||
outputSession.WaitWithDefaultTimeout()
|
outputSession.WaitWithDefaultTimeout()
|
||||||
Expect(outputSession).Should(Exit(0))
|
Expect(outputSession).Should(ExitCleanly())
|
||||||
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman named volume copyup of /var", func() {
|
It("podman named volume copyup of /var", func() {
|
||||||
baselineSession := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ls", "/var"})
|
baselineSession := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ls", "/var"})
|
||||||
baselineSession.WaitWithDefaultTimeout()
|
baselineSession.WaitWithDefaultTimeout()
|
||||||
Expect(baselineSession).Should(Exit(0))
|
Expect(baselineSession).Should(ExitCleanly())
|
||||||
baselineOutput := baselineSession.OutputToString()
|
baselineOutput := baselineSession.OutputToString()
|
||||||
|
|
||||||
outputSession := podmanTest.Podman([]string{"run", "-v", "/var", fedoraMinimal, "ls", "/var"})
|
outputSession := podmanTest.Podman([]string{"run", "-v", "/var", fedoraMinimal, "ls", "/var"})
|
||||||
outputSession.WaitWithDefaultTimeout()
|
outputSession.WaitWithDefaultTimeout()
|
||||||
Expect(outputSession).Should(Exit(0))
|
Expect(outputSession).Should(ExitCleanly())
|
||||||
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman read-only tmpfs conflict with volume", func() {
|
It("podman read-only tmpfs conflict with volume", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"})
|
session := podmanTest.Podman([]string{"run", "--rm", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session2 := podmanTest.Podman([]string{"run", "--rm", "--read-only", "--tmpfs", dest, ALPINE, "touch", dest + "/a"})
|
session2 := podmanTest.Podman([]string{"run", "--rm", "--read-only", "--tmpfs", dest, ALPINE, "touch", dest + "/a"})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with anonymous volume", func() {
|
It("podman run with anonymous volume", func() {
|
||||||
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list1.WaitWithDefaultTimeout()
|
list1.WaitWithDefaultTimeout()
|
||||||
Expect(list1).Should(Exit(0))
|
Expect(list1).Should(ExitCleanly())
|
||||||
Expect(list1.OutputToString()).To(Equal(""))
|
Expect(list1.OutputToString()).To(Equal(""))
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"create", "-v", "/test", ALPINE, "top"})
|
session := podmanTest.Podman([]string{"create", "-v", "/test", ALPINE, "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list2.WaitWithDefaultTimeout()
|
list2.WaitWithDefaultTimeout()
|
||||||
Expect(list2).Should(Exit(0))
|
Expect(list2).Should(ExitCleanly())
|
||||||
arr := list2.OutputToStringArray()
|
arr := list2.OutputToStringArray()
|
||||||
Expect(arr).To(HaveLen(1))
|
Expect(arr).To(HaveLen(1))
|
||||||
Expect(arr[0]).To(Not(Equal("")))
|
Expect(arr[0]).To(Not(Equal("")))
|
||||||
|
|
@ -507,57 +507,57 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
It("podman rm -v removes anonymous volume", func() {
|
It("podman rm -v removes anonymous volume", func() {
|
||||||
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list1.WaitWithDefaultTimeout()
|
list1.WaitWithDefaultTimeout()
|
||||||
Expect(list1).Should(Exit(0))
|
Expect(list1).Should(ExitCleanly())
|
||||||
Expect(list1.OutputToString()).To(Equal(""))
|
Expect(list1.OutputToString()).To(Equal(""))
|
||||||
|
|
||||||
ctrName := "testctr"
|
ctrName := "testctr"
|
||||||
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", "/test", ALPINE, "top"})
|
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", "/test", ALPINE, "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list2.WaitWithDefaultTimeout()
|
list2.WaitWithDefaultTimeout()
|
||||||
Expect(list2).Should(Exit(0))
|
Expect(list2).Should(ExitCleanly())
|
||||||
arr := list2.OutputToStringArray()
|
arr := list2.OutputToStringArray()
|
||||||
Expect(arr).To(HaveLen(1))
|
Expect(arr).To(HaveLen(1))
|
||||||
Expect(arr[0]).To(Not(Equal("")))
|
Expect(arr[0]).To(Not(Equal("")))
|
||||||
|
|
||||||
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
|
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
|
||||||
remove.WaitWithDefaultTimeout()
|
remove.WaitWithDefaultTimeout()
|
||||||
Expect(remove).Should(Exit(0))
|
Expect(remove).Should(ExitCleanly())
|
||||||
|
|
||||||
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list3.WaitWithDefaultTimeout()
|
list3.WaitWithDefaultTimeout()
|
||||||
Expect(list3).Should(Exit(0))
|
Expect(list3).Should(ExitCleanly())
|
||||||
Expect(list3.OutputToString()).To(Equal(""))
|
Expect(list3.OutputToString()).To(Equal(""))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman rm -v retains named volume", func() {
|
It("podman rm -v retains named volume", func() {
|
||||||
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list1 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list1.WaitWithDefaultTimeout()
|
list1.WaitWithDefaultTimeout()
|
||||||
Expect(list1).Should(Exit(0))
|
Expect(list1).Should(ExitCleanly())
|
||||||
Expect(list1.OutputToString()).To(Equal(""))
|
Expect(list1.OutputToString()).To(Equal(""))
|
||||||
|
|
||||||
ctrName := "testctr"
|
ctrName := "testctr"
|
||||||
volName := "testvol"
|
volName := "testvol"
|
||||||
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "top"})
|
session := podmanTest.Podman([]string{"create", "--name", ctrName, "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list2 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list2.WaitWithDefaultTimeout()
|
list2.WaitWithDefaultTimeout()
|
||||||
Expect(list2).Should(Exit(0))
|
Expect(list2).Should(ExitCleanly())
|
||||||
arr := list2.OutputToStringArray()
|
arr := list2.OutputToStringArray()
|
||||||
Expect(arr).To(HaveLen(1))
|
Expect(arr).To(HaveLen(1))
|
||||||
Expect(arr[0]).To(Equal(volName))
|
Expect(arr[0]).To(Equal(volName))
|
||||||
|
|
||||||
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
|
remove := podmanTest.Podman([]string{"rm", "-v", ctrName})
|
||||||
remove.WaitWithDefaultTimeout()
|
remove.WaitWithDefaultTimeout()
|
||||||
Expect(remove).Should(Exit(0))
|
Expect(remove).Should(ExitCleanly())
|
||||||
|
|
||||||
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
list3 := podmanTest.Podman([]string{"volume", "list", "--quiet"})
|
||||||
list3.WaitWithDefaultTimeout()
|
list3.WaitWithDefaultTimeout()
|
||||||
Expect(list3).Should(Exit(0))
|
Expect(list3).Should(ExitCleanly())
|
||||||
arr2 := list3.OutputToStringArray()
|
arr2 := list3.OutputToStringArray()
|
||||||
Expect(arr2).To(HaveLen(1))
|
Expect(arr2).To(HaveLen(1))
|
||||||
Expect(arr2[0]).To(Equal(volName))
|
Expect(arr2[0]).To(Equal(volName))
|
||||||
|
|
@ -566,7 +566,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
It("podman run image volume is not noexec", func() {
|
It("podman run image volume is not noexec", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", REDIS_IMAGE, "grep", "/data", "/proc/self/mountinfo"})
|
session := podmanTest.Podman([]string{"run", "--rm", REDIS_IMAGE, "grep", "/data", "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Not(ContainSubstring("noexec")))
|
Expect(session.OutputToString()).To(Not(ContainSubstring("noexec")))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -574,7 +574,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
volName := "testVol"
|
volName := "testVol"
|
||||||
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=invalid", volName})
|
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", "--opt", "device=tmpfs", "--opt", "o=invalid", volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/tmp", volName), ALPINE, "ls"})
|
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/tmp", volName), ALPINE, "ls"})
|
||||||
volMount.WaitWithDefaultTimeout()
|
volMount.WaitWithDefaultTimeout()
|
||||||
|
|
@ -585,11 +585,11 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
volName := "testVol"
|
volName := "testVol"
|
||||||
volCreate := podmanTest.Podman([]string{"volume", "create", volName})
|
volCreate := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
volPath := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Mountpoint}}", volName})
|
volPath := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Mountpoint}}", volName})
|
||||||
volPath.WaitWithDefaultTimeout()
|
volPath.WaitWithDefaultTimeout()
|
||||||
Expect(volPath).Should(Exit(0))
|
Expect(volPath).Should(ExitCleanly())
|
||||||
path := volPath.OutputToString()
|
path := volPath.OutputToString()
|
||||||
|
|
||||||
fileName := "thisIsATestFile"
|
fileName := "thisIsATestFile"
|
||||||
|
|
@ -599,7 +599,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
||||||
|
|
||||||
runLs := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"})
|
runLs := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"})
|
||||||
runLs.WaitWithDefaultTimeout()
|
runLs.WaitWithDefaultTimeout()
|
||||||
Expect(runLs).Should(Exit(0))
|
Expect(runLs).Should(ExitCleanly())
|
||||||
outputArr := runLs.OutputToStringArray()
|
outputArr := runLs.OutputToStringArray()
|
||||||
Expect(outputArr).To(HaveLen(1))
|
Expect(outputArr).To(HaveLen(1))
|
||||||
Expect(outputArr[0]).To(ContainSubstring(fileName))
|
Expect(outputArr[0]).To(ContainSubstring(fileName))
|
||||||
|
|
@ -614,7 +614,7 @@ VOLUME /test/`, ALPINE)
|
||||||
ctrName := "testCtr"
|
ctrName := "testCtr"
|
||||||
create := podmanTest.Podman([]string{"create", "-v", "/tmp:/test", "--name", ctrName, image, "ls"})
|
create := podmanTest.Podman([]string{"create", "-v", "/tmp:/test", "--name", ctrName, image, "ls"})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
data := podmanTest.InspectContainer(ctrName)
|
data := podmanTest.InspectContainer(ctrName)
|
||||||
Expect(data).To(HaveLen(1))
|
Expect(data).To(HaveLen(1))
|
||||||
|
|
@ -648,39 +648,39 @@ VOLUME /test/`, ALPINE)
|
||||||
// Make sure host files show up in the container
|
// Make sure host files show up in the container
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "-v", volumeFlag, ALPINE, "ls", "/run/test/test1"})
|
session := podmanTest.Podman([]string{"run", "--rm", "-v", volumeFlag, ALPINE, "ls", "/run/test/test1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "-v", ".:/app:O", ALPINE, "ls", "/app"})
|
session = podmanTest.Podman([]string{"run", "--rm", "-v", ".:/app:O", ALPINE, "ls", "/app"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.OutputToString()).To(ContainSubstring(filepath.Base(CurrentSpecReport().FileName())))
|
Expect(session.OutputToString()).To(ContainSubstring(filepath.Base(CurrentSpecReport().FileName())))
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure modifications in container do not show up on host
|
// Make sure modifications in container do not show up on host
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "-v", volumeFlag, ALPINE, "touch", "/run/test/container"})
|
session = podmanTest.Podman([]string{"run", "--rm", "-v", volumeFlag, ALPINE, "touch", "/run/test/container"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
_, err = os.Stat(filepath.Join(mountPath, "container"))
|
_, err = os.Stat(filepath.Join(mountPath, "container"))
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
|
|
||||||
// Make sure modifications in container disappear when container is stopped
|
// Make sure modifications in container disappear when container is stopped
|
||||||
session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
|
session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"start", "-l"})
|
session = podmanTest.Podman([]string{"start", "-l"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"exec", "-l", "touch", "/run/test/container"})
|
session = podmanTest.Podman([]string{"exec", "-l", "touch", "/run/test/container"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
|
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"stop", "-l"})
|
session = podmanTest.Podman([]string{"stop", "-l"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"start", "-l"})
|
session = podmanTest.Podman([]string{"start", "-l"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
|
session = podmanTest.Podman([]string{"exec", "-l", "ls", "/run/test/container"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(ExitWithError())
|
Expect(session).To(ExitWithError())
|
||||||
|
|
@ -702,7 +702,7 @@ VOLUME /test/`, ALPINE)
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"volume", "create", volName})
|
session := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// overlay and named volume destinations conflict
|
// overlay and named volume destinations conflict
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "-v", fmt.Sprintf("%s:%s", volName, mountDest), ALPINE})
|
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "-v", fmt.Sprintf("%s:%s", volName, mountDest), ALPINE})
|
||||||
|
|
@ -722,7 +722,7 @@ VOLUME /test/`, ALPINE)
|
||||||
volName := "testVol1"
|
volName := "testVol1"
|
||||||
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"})
|
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -760,18 +760,18 @@ VOLUME /test/`, ALPINE)
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "auto", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "auto", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
||||||
|
|
||||||
vol += ",O"
|
vol += ",O"
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "keep-id", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--userns", "keep-id", "-v", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
Expect(session.OutputToString()).To(ContainSubstring("888:888"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -800,7 +800,7 @@ VOLUME /test/`, ALPINE)
|
||||||
vol := "type=bind,src=" + mountPath + ",dst=" + dest + ",U=false"
|
vol := "type=bind,src=" + mountPath + ",dst=" + dest + ",U=false"
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).ShouldNot(Equal("888:888"))
|
Expect(session.OutputToString()).ShouldNot(Equal("888:888"))
|
||||||
|
|
||||||
// invalid bind mount
|
// invalid bind mount
|
||||||
|
|
@ -813,32 +813,32 @@ VOLUME /test/`, ALPINE)
|
||||||
vol = "type=bind,src=" + mountPath + ",dst=" + dest + ",U=true"
|
vol = "type=bind,src=" + mountPath + ",dst=" + dest + ",U=true"
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("888:888"))
|
Expect(session.OutputToString()).Should(Equal("888:888"))
|
||||||
|
|
||||||
// tmpfs mount
|
// tmpfs mount
|
||||||
vol = "type=tmpfs," + "dst=" + dest + ",chown"
|
vol = "type=tmpfs," + "dst=" + dest + ",chown"
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("888:888"))
|
Expect(session.OutputToString()).Should(Equal("888:888"))
|
||||||
|
|
||||||
// anonymous volume mount
|
// anonymous volume mount
|
||||||
vol = "type=volume," + "dst=" + dest
|
vol = "type=volume," + "dst=" + dest
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("888:888"))
|
Expect(session.OutputToString()).Should(Equal("888:888"))
|
||||||
|
|
||||||
// named volume mount
|
// named volume mount
|
||||||
namedVolume := podmanTest.Podman([]string{"volume", "create", "foo"})
|
namedVolume := podmanTest.Podman([]string{"volume", "create", "foo"})
|
||||||
namedVolume.WaitWithDefaultTimeout()
|
namedVolume.WaitWithDefaultTimeout()
|
||||||
Expect(namedVolume).Should(Exit(0))
|
Expect(namedVolume).Should(ExitCleanly())
|
||||||
|
|
||||||
vol = "type=volume,src=foo,dst=" + dest + ",chown=true"
|
vol = "type=volume,src=foo,dst=" + dest + ",chown=true"
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("888:888"))
|
Expect(session.OutputToString()).Should(Equal("888:888"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -847,11 +847,11 @@ VOLUME /test/`, ALPINE)
|
||||||
vol := "type=volume,source=test_vol,dst=/test,volume-opt=type=tmpfs,volume-opt=device=tmpfs,volume-opt=o=nodev"
|
vol := "type=volume,source=test_vol,dst=/test,volume-opt=type=tmpfs,volume-opt=device=tmpfs,volume-opt=o=nodev"
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", "--mount", vol, ALPINE, "echo", "hello"})
|
session := podmanTest.Podman([]string{"run", "--rm", "--mount", vol, ALPINE, "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
inspectVol := podmanTest.Podman([]string{"volume", "inspect", "test_vol"})
|
inspectVol := podmanTest.Podman([]string{"volume", "inspect", "test_vol"})
|
||||||
inspectVol.WaitWithDefaultTimeout()
|
inspectVol.WaitWithDefaultTimeout()
|
||||||
Expect(inspectVol).Should(Exit(0))
|
Expect(inspectVol).Should(ExitCleanly())
|
||||||
Expect(inspectVol.OutputToString()).To(ContainSubstring("nodev"))
|
Expect(inspectVol.OutputToString()).To(ContainSubstring("nodev"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -866,17 +866,17 @@ USER testuser`, fedoraMinimal)
|
||||||
|
|
||||||
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
||||||
test1.WaitWithDefaultTimeout()
|
test1.WaitWithDefaultTimeout()
|
||||||
Expect(test1).Should(Exit(0))
|
Expect(test1).Should(ExitCleanly())
|
||||||
Expect(test1.OutputToString()).To(ContainSubstring(testString))
|
Expect(test1.OutputToString()).To(ContainSubstring(testString))
|
||||||
|
|
||||||
volName := "testvol2"
|
volName := "testvol2"
|
||||||
vol := podmanTest.Podman([]string{"volume", "create", volName})
|
vol := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
vol.WaitWithDefaultTimeout()
|
vol.WaitWithDefaultTimeout()
|
||||||
Expect(vol).Should(Exit(0))
|
Expect(vol).Should(ExitCleanly())
|
||||||
|
|
||||||
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
||||||
test2.WaitWithDefaultTimeout()
|
test2.WaitWithDefaultTimeout()
|
||||||
Expect(test2).Should(Exit(0))
|
Expect(test2).Should(ExitCleanly())
|
||||||
Expect(test2.OutputToString()).To(ContainSubstring(testString))
|
Expect(test2.OutputToString()).To(ContainSubstring(testString))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -884,12 +884,12 @@ USER testuser`, fedoraMinimal)
|
||||||
It("podman run with named volume check if we honor permission of target dir", func() {
|
It("podman run with named volume check if we honor permission of target dir", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
|
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
perms := session.OutputToString()
|
perms := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--rm", "-v", "test:/var/tmp", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
|
session = podmanTest.Podman([]string{"run", "--rm", "-v", "test:/var/tmp", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(perms))
|
Expect(session.OutputToString()).To(Equal(perms))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -900,7 +900,7 @@ USER testuser`, fedoraMinimal)
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "-v", mountSrc + ":/run", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "-v", mountSrc + ":/run", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// the file should not have been created
|
// the file should not have been created
|
||||||
_, err = os.Stat(filepath.Join(mountSrc, ".containerenv"))
|
_, err = os.Stat(filepath.Join(mountSrc, ".containerenv"))
|
||||||
|
|
@ -911,31 +911,31 @@ USER testuser`, fedoraMinimal)
|
||||||
volName := "testVol"
|
volName := "testVol"
|
||||||
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000", volName})
|
volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000", volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u", "/test"})
|
volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u", "/test"})
|
||||||
volMount.WaitWithDefaultTimeout()
|
volMount.WaitWithDefaultTimeout()
|
||||||
Expect(volMount).Should(Exit(0))
|
Expect(volMount).Should(ExitCleanly())
|
||||||
Expect(volMount.OutputToString()).To(Equal("1000"))
|
Expect(volMount.OutputToString()).To(Equal("1000"))
|
||||||
|
|
||||||
volName = "testVol2"
|
volName = "testVol2"
|
||||||
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=gid=1000", volName})
|
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=gid=1000", volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%g", "/test"})
|
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%g", "/test"})
|
||||||
volMount.WaitWithDefaultTimeout()
|
volMount.WaitWithDefaultTimeout()
|
||||||
Expect(volMount).Should(Exit(0))
|
Expect(volMount).Should(ExitCleanly())
|
||||||
Expect(volMount.OutputToString()).To(Equal("1000"))
|
Expect(volMount.OutputToString()).To(Equal("1000"))
|
||||||
|
|
||||||
volName = "testVol3"
|
volName = "testVol3"
|
||||||
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000,gid=1000", volName})
|
volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000,gid=1000", volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u:%g", "/test"})
|
volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u:%g", "/test"})
|
||||||
volMount.WaitWithDefaultTimeout()
|
volMount.WaitWithDefaultTimeout()
|
||||||
Expect(volMount).Should(Exit(0))
|
Expect(volMount).Should(ExitCleanly())
|
||||||
Expect(volMount.OutputToString()).To(Equal("1000:1000"))
|
Expect(volMount.OutputToString()).To(Equal("1000:1000"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -963,7 +963,7 @@ USER testuser`, fedoraMinimal)
|
||||||
|
|
||||||
run := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "./:" + dest, ALPINE, "ls", dest})
|
run := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "./:" + dest, ALPINE, "ls", dest})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(ExitCleanly())
|
||||||
Expect(run.OutputToString()).Should(ContainSubstring(strings.TrimLeft("/vol/", f.Name())))
|
Expect(run.OutputToString()).Should(ContainSubstring(strings.TrimLeft("/vol/", f.Name())))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -15,7 +16,7 @@ var _ = Describe("Podman run", func() {
|
||||||
It("podman run a container without workdir", func() {
|
It("podman run a container without workdir", func() {
|
||||||
session := podmanTest.Podman([]string{"run", ALPINE, "pwd"})
|
session := podmanTest.Podman([]string{"run", ALPINE, "pwd"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("/"))
|
Expect(session.OutputToString()).To(Equal("/"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ var _ = Describe("Podman run", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run a container on an image with a workdir", func() {
|
It("podman run a container on an image with a workdir", func() {
|
||||||
|
|
@ -43,7 +44,7 @@ WORKDIR /etc/foobar`, ALPINE)
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "test", "pwd"})
|
session := podmanTest.Podman([]string{"run", "test", "pwd"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("/etc/foobar"))
|
Expect(session.OutputToString()).To(Equal("/etc/foobar"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."})
|
session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."})
|
||||||
|
|
@ -52,7 +53,7 @@ WORKDIR /etc/foobar`, ALPINE)
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"})
|
session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal("/home/foobar"))
|
Expect(session.OutputToString()).To(Equal("/home/foobar"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -11,7 +12,7 @@ var _ = Describe("podman system dial-stdio", func() {
|
||||||
It("podman system dial-stdio help", func() {
|
It("podman system dial-stdio help", func() {
|
||||||
session := podmanTest.Podman([]string{"system", "dial-stdio", "--help"})
|
session := podmanTest.Podman([]string{"system", "dial-stdio", "--help"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("Examples: podman system dial-stdio"))
|
Expect(session.OutputToString()).To(ContainSubstring("Examples: podman system dial-stdio"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// system reset must run serial: https://github.com/containers/podman/issues/17903
|
// system reset must run serial: https://github.com/containers/podman/issues/17903
|
||||||
|
|
@ -16,51 +16,51 @@ var _ = Describe("podman system reset", Serial, func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"rmi", "--force", "--all"})
|
session := podmanTest.Podman([]string{"rmi", "--force", "--all"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"images", "-n"})
|
session = podmanTest.Podman([]string{"images", "-n"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
l := len(session.OutputToStringArray())
|
l := len(session.OutputToStringArray())
|
||||||
|
|
||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "data"})
|
session = podmanTest.Podman([]string{"volume", "create", "data"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "-v", "data:/data", ALPINE, "echo", "hello"})
|
session = podmanTest.Podman([]string{"create", "-v", "data:/data", ALPINE, "echo", "hello"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"network", "create"})
|
session = podmanTest.Podman([]string{"network", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"system", "reset", "-f"})
|
session = podmanTest.Podman([]string{"system", "reset", "-f"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process")))
|
Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process")))
|
||||||
Expect(session.ErrorToString()).To(Not(ContainSubstring("/usr/share/containers/storage.conf")))
|
Expect(session.ErrorToString()).To(Not(ContainSubstring("/usr/share/containers/storage.conf")))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"images", "-n"})
|
session = podmanTest.Podman([]string{"images", "-n"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(l))
|
Expect(session.OutputToStringArray()).To(HaveLen(l))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"container", "ls", "-q"})
|
session = podmanTest.Podman([]string{"container", "ls", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"network", "ls", "-q"})
|
session = podmanTest.Podman([]string{"network", "ls", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
// default network should exists
|
// default network should exists
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ var _ = Describe("podman system reset", Serial, func() {
|
||||||
if isRootless() {
|
if isRootless() {
|
||||||
session = podmanTest.Podman([]string{"machine", "list", "-q"})
|
session = podmanTest.Podman([]string{"machine", "list", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Without Ordered, tests flake with "Getting key identity" (#18358)
|
// Without Ordered, tests flake with "Getting key identity" (#18358)
|
||||||
|
|
@ -21,7 +20,7 @@ var _ = Describe("Podman trust", Ordered, func() {
|
||||||
It("podman image trust show", func() {
|
It("podman image trust show", func() {
|
||||||
session := podmanTest.Podman([]string{"image", "trust", "show", "-n", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json")})
|
session := podmanTest.Podman([]string{"image", "trust", "show", "-n", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json")})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
outArray := session.OutputToStringArray()
|
outArray := session.OutputToStringArray()
|
||||||
Expect(outArray).To(HaveLen(3))
|
Expect(outArray).To(HaveLen(3))
|
||||||
|
|
||||||
|
|
@ -36,7 +35,7 @@ var _ = Describe("Podman trust", Ordered, func() {
|
||||||
policyJSON := filepath.Join(podmanTest.TempDir, "trust_set_test.json")
|
policyJSON := filepath.Join(podmanTest.TempDir, "trust_set_test.json")
|
||||||
session := podmanTest.Podman([]string{"image", "trust", "set", "--policypath", policyJSON, "-t", "accept", "default"})
|
session := podmanTest.Podman([]string{"image", "trust", "set", "--policypath", policyJSON, "-t", "accept", "default"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
var teststruct map[string][]map[string]string
|
var teststruct map[string][]map[string]string
|
||||||
policyContent, err := os.ReadFile(policyJSON)
|
policyContent, err := os.ReadFile(policyJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -52,7 +51,7 @@ var _ = Describe("Podman trust", Ordered, func() {
|
||||||
It("podman image trust show --json", func() {
|
It("podman image trust show --json", func() {
|
||||||
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--json"})
|
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--json"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(BeValidJSON())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
var teststruct []map[string]string
|
var teststruct []map[string]string
|
||||||
err = json.Unmarshal(session.Out.Contents(), &teststruct)
|
err = json.Unmarshal(session.Out.Contents(), &teststruct)
|
||||||
|
|
@ -91,7 +90,7 @@ var _ = Describe("Podman trust", Ordered, func() {
|
||||||
It("podman image trust show --raw", func() {
|
It("podman image trust show --raw", func() {
|
||||||
session := podmanTest.Podman([]string{"image", "trust", "show", "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--raw"})
|
session := podmanTest.Podman([]string{"image", "trust", "show", "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--raw"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
contents, err := os.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
contents, err := os.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
Expect(err).ShouldNot(HaveOccurred())
|
||||||
Expect(session.OutputToString()).To(BeValidJSON())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package integration
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -13,7 +14,7 @@ import (
|
||||||
func cleanupRootlessSlirp4netns(p *PodmanTestIntegration) {
|
func cleanupRootlessSlirp4netns(p *PodmanTestIntegration) {
|
||||||
session := p.Podman([]string{"run", "--network", "bridge", ALPINE, "true"})
|
session := p.Podman([]string{"run", "--network", "bridge", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = Describe("Podman unshare", func() {
|
var _ = Describe("Podman unshare", func() {
|
||||||
|
|
@ -32,7 +33,7 @@ var _ = Describe("Podman unshare", func() {
|
||||||
userNS, _ := os.Readlink("/proc/self/ns/user")
|
userNS, _ := os.Readlink("/proc/self/ns/user")
|
||||||
session := podmanTest.Podman([]string{"unshare", "readlink", "/proc/self/ns/user"})
|
session := podmanTest.Podman([]string{"unshare", "readlink", "/proc/self/ns/user"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).ToNot(ContainSubstring(userNS))
|
Expect(session.OutputToString()).ToNot(ContainSubstring(userNS))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -41,7 +42,7 @@ var _ = Describe("Podman unshare", func() {
|
||||||
defer cleanupRootlessSlirp4netns(podmanTest)
|
defer cleanupRootlessSlirp4netns(podmanTest)
|
||||||
session := podmanTest.Podman([]string{"unshare", "--rootless-netns", "ip", "addr"})
|
session := podmanTest.Podman([]string{"unshare", "--rootless-netns", "ip", "addr"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("tap0"))
|
Expect(session.OutputToString()).To(ContainSubstring("tap0"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containers/common/pkg/cgroupv2"
|
"github.com/containers/common/pkg/cgroupv2"
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman update", func() {
|
var _ = Describe("Podman update", func() {
|
||||||
|
|
@ -14,7 +14,7 @@ var _ = Describe("Podman update", func() {
|
||||||
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
||||||
session := podmanTest.Podman([]string{"run", "-dt", ALPINE})
|
session := podmanTest.Podman([]string{"run", "-dt", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID := session.OutputToString()
|
ctrID := session.OutputToString()
|
||||||
|
|
||||||
|
|
@ -32,48 +32,48 @@ var _ = Describe("Podman update", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman(commonArgs)
|
session = podmanTest.Podman(commonArgs)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// checking cpu quota from --cpus
|
// checking cpu quota from --cpus
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
||||||
|
|
||||||
// checking cpuset-cpus
|
// checking cpuset-cpus
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("0"))
|
Expect(session.OutputToString()).Should(Equal("0"))
|
||||||
|
|
||||||
// checking cpuset-mems
|
// checking cpuset-mems
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("0"))
|
Expect(session.OutputToString()).Should(Equal("0"))
|
||||||
|
|
||||||
// checking memory limit
|
// checking memory limit
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
||||||
|
|
||||||
// checking memory-swap
|
// checking memory-swap
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("2147483648"))
|
Expect(session.OutputToString()).Should(ContainSubstring("2147483648"))
|
||||||
|
|
||||||
// checking cpu-shares
|
// checking cpu-shares
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
||||||
|
|
||||||
// checking pids-limit
|
// checking pids-limit
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids/pids.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids/pids.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -83,7 +83,7 @@ var _ = Describe("Podman update", func() {
|
||||||
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
||||||
session := podmanTest.Podman([]string{"run", "-dt", "--pids-limit", "-1", ALPINE})
|
session := podmanTest.Podman([]string{"run", "-dt", "--pids-limit", "-1", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID := session.OutputToString()
|
ctrID := session.OutputToString()
|
||||||
|
|
||||||
|
|
@ -94,14 +94,14 @@ var _ = Describe("Podman update", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman(commonArgs)
|
session = podmanTest.Podman(commonArgs)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID = session.OutputToString()
|
ctrID = session.OutputToString()
|
||||||
|
|
||||||
// checking pids-limit was not changed after update when not specified as an option
|
// checking pids-limit was not changed after update when not specified as an option
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("max"))
|
Expect(session.OutputToString()).Should(ContainSubstring("max"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ var _ = Describe("Podman update", func() {
|
||||||
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
||||||
session := podmanTest.Podman([]string{"run", "-dt", ALPINE})
|
session := podmanTest.Podman([]string{"run", "-dt", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID := session.OutputToString()
|
ctrID := session.OutputToString()
|
||||||
|
|
||||||
|
|
@ -133,62 +133,62 @@ var _ = Describe("Podman update", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman(commonArgs)
|
session = podmanTest.Podman(commonArgs)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID = session.OutputToString()
|
ctrID = session.OutputToString()
|
||||||
|
|
||||||
// checking cpu quota and period
|
// checking cpu quota and period
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
||||||
|
|
||||||
// checking blkio weight
|
// checking blkio weight
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.bfq.weight"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.bfq.weight"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
||||||
|
|
||||||
// checking device-read/write-bps/iops
|
// checking device-read/write-bps/iops
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("rbps=10485760 wbps=10485760 riops=1000 wiops=1000"))
|
Expect(session.OutputToString()).Should(ContainSubstring("rbps=10485760 wbps=10485760 riops=1000 wiops=1000"))
|
||||||
|
|
||||||
// checking cpuset-cpus
|
// checking cpuset-cpus
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.cpus"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.cpus"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("0"))
|
Expect(session.OutputToString()).Should(Equal("0"))
|
||||||
|
|
||||||
// checking cpuset-mems
|
// checking cpuset-mems
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.mems"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.mems"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(Equal("0"))
|
Expect(session.OutputToString()).Should(Equal("0"))
|
||||||
|
|
||||||
// checking memory limit
|
// checking memory limit
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
||||||
|
|
||||||
// checking memory-swap
|
// checking memory-swap
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.swap.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.swap.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
|
||||||
|
|
||||||
// checking cpu-shares
|
// checking cpu-shares
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.weight"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.weight"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("5"))
|
Expect(session.OutputToString()).Should(ContainSubstring("5"))
|
||||||
|
|
||||||
// checking pids-limit
|
// checking pids-limit
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -196,7 +196,7 @@ var _ = Describe("Podman update", func() {
|
||||||
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
SkipIfRootless("many of these handlers are not enabled while rootless in CI")
|
||||||
session := podmanTest.Podman([]string{"run", "-dt", "--cpus", "5", ALPINE})
|
session := podmanTest.Podman([]string{"run", "-dt", "--cpus", "5", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{
|
session = podmanTest.Podman([]string{
|
||||||
"update",
|
"update",
|
||||||
|
|
@ -205,7 +205,7 @@ var _ = Describe("Podman update", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
ctrID := session.OutputToString()
|
ctrID := session.OutputToString()
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ var _ = Describe("Podman update", func() {
|
||||||
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
|
||||||
}
|
}
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
Expect(session.OutputToString()).Should(ContainSubstring("500000"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var _ = Describe("Podman volume create", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create"})
|
session := podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
check.WaitWithDefaultTimeout()
|
check.WaitWithDefaultTimeout()
|
||||||
|
|
@ -32,7 +32,7 @@ var _ = Describe("Podman volume create", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
check := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
check.WaitWithDefaultTimeout()
|
check.WaitWithDefaultTimeout()
|
||||||
|
|
@ -43,7 +43,7 @@ var _ = Describe("Podman volume create", func() {
|
||||||
It("podman create volume with existing name fails", func() {
|
It("podman create volume with existing name fails", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session = podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -54,11 +54,11 @@ var _ = Describe("Podman volume create", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--ignore", "myvol"})
|
session = podmanTest.Podman([]string{"volume", "create", "--ignore", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(volName))
|
Expect(session.OutputToString()).To(Equal(volName))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -70,19 +70,19 @@ var _ = Describe("Podman volume create", func() {
|
||||||
volName := "my_vol_" + RandomString(10)
|
volName := "my_vol_" + RandomString(10)
|
||||||
session := podmanTest.Podman([]string{"volume", "create", volName})
|
session := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(volName))
|
Expect(session.OutputToString()).To(Equal(volName))
|
||||||
|
|
||||||
helloString := "hello-" + RandomString(20)
|
helloString := "hello-" + RandomString(20)
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo " + helloString + " >> /data/test"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo " + helloString + " >> /data/test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
// export to tar file...
|
// export to tar file...
|
||||||
helloTar := filepath.Join(podmanTest.TempDir, "hello.tar")
|
helloTar := filepath.Join(podmanTest.TempDir, "hello.tar")
|
||||||
check := podmanTest.Podman([]string{"volume", "export", "-o", helloTar, volName})
|
check := podmanTest.Podman([]string{"volume", "export", "-o", helloTar, volName})
|
||||||
check.WaitWithDefaultTimeout()
|
check.WaitWithDefaultTimeout()
|
||||||
Expect(check).Should(Exit(0))
|
Expect(check).Should(ExitCleanly())
|
||||||
|
|
||||||
// ...then confirm that tar file has our desired content.
|
// ...then confirm that tar file has our desired content.
|
||||||
// These flags emit filename to stderr (-v), contents to stdout
|
// These flags emit filename to stderr (-v), contents to stdout
|
||||||
|
|
@ -101,25 +101,25 @@ var _ = Describe("Podman volume create", func() {
|
||||||
volName := "my_vol_" + RandomString(10)
|
volName := "my_vol_" + RandomString(10)
|
||||||
session := podmanTest.Podman([]string{"volume", "create", volName})
|
session := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(volName))
|
Expect(session.OutputToString()).To(Equal(volName))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> /data/test"})
|
session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> /data/test"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
helloTar := filepath.Join(podmanTest.TempDir, "hello.tar")
|
helloTar := filepath.Join(podmanTest.TempDir, "hello.tar")
|
||||||
session = podmanTest.Podman([]string{"volume", "export", volName, "--output", helloTar})
|
session = podmanTest.Podman([]string{"volume", "export", volName, "--output", helloTar})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "my_vol2"})
|
session = podmanTest.Podman([]string{"volume", "create", "my_vol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "import", "my_vol2", helloTar})
|
session = podmanTest.Podman([]string{"volume", "import", "my_vol2", helloTar})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(""), "output of volume import")
|
Expect(session.OutputToString()).To(Equal(""), "output of volume import")
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"run", "--volume", "my_vol2:/data", ALPINE, "cat", "/data/test"})
|
session = podmanTest.Podman([]string{"run", "--volume", "my_vol2:/data", ALPINE, "cat", "/data/test"})
|
||||||
|
|
@ -159,16 +159,16 @@ var _ = Describe("Podman volume create", func() {
|
||||||
gid := "4000"
|
gid := "4000"
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--opt", fmt.Sprintf("o=uid=%s,gid=%s", uid, gid), volName})
|
session := podmanTest.Podman([]string{"volume", "create", "--opt", fmt.Sprintf("o=uid=%s,gid=%s", uid, gid), volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", volName})
|
inspectUID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .UID }}", volName})
|
||||||
inspectUID.WaitWithDefaultTimeout()
|
inspectUID.WaitWithDefaultTimeout()
|
||||||
Expect(inspectUID).Should(Exit(0))
|
Expect(inspectUID).Should(ExitCleanly())
|
||||||
Expect(inspectUID.OutputToString()).To(Equal(uid))
|
Expect(inspectUID.OutputToString()).To(Equal(uid))
|
||||||
|
|
||||||
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", volName})
|
inspectGID := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .GID }}", volName})
|
||||||
inspectGID.WaitWithDefaultTimeout()
|
inspectGID.WaitWithDefaultTimeout()
|
||||||
Expect(inspectGID).Should(Exit(0))
|
Expect(inspectGID).Should(ExitCleanly())
|
||||||
Expect(inspectGID.OutputToString()).To(Equal(gid))
|
Expect(inspectGID.OutputToString()).To(Equal(gid))
|
||||||
|
|
||||||
// options should contain `uid=3000,gid=4000:3000:4000`
|
// options should contain `uid=3000,gid=4000:3000:4000`
|
||||||
|
|
@ -176,7 +176,7 @@ var _ = Describe("Podman volume create", func() {
|
||||||
optionStrFormatExpect := fmt.Sprintf(`uid=%s,gid=%s:%s:%s`, uid, gid, uid, gid)
|
optionStrFormatExpect := fmt.Sprintf(`uid=%s,gid=%s:%s:%s`, uid, gid, uid, gid)
|
||||||
inspectOpts := podmanTest.Podman([]string{"volume", "inspect", "--format", optionFormat, volName})
|
inspectOpts := podmanTest.Podman([]string{"volume", "inspect", "--format", optionFormat, volName})
|
||||||
inspectOpts.WaitWithDefaultTimeout()
|
inspectOpts.WaitWithDefaultTimeout()
|
||||||
Expect(inspectOpts).Should(Exit(0))
|
Expect(inspectOpts).Should(ExitCleanly())
|
||||||
Expect(inspectOpts.OutputToString()).To(Equal(optionStrFormatExpect))
|
Expect(inspectOpts.OutputToString()).To(Equal(optionStrFormatExpect))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -185,25 +185,25 @@ var _ = Describe("Podman volume create", func() {
|
||||||
volName := "testvol"
|
volName := "testvol"
|
||||||
volCreate := podmanTest.Podman([]string{"volume", "create", "--driver", "image", "--opt", fmt.Sprintf("image=%s", fedoraMinimal), volName})
|
volCreate := podmanTest.Podman([]string{"volume", "create", "--driver", "image", "--opt", fmt.Sprintf("image=%s", fedoraMinimal), volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
runCmd := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "cat", "/test/etc/redhat-release"})
|
runCmd := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "cat", "/test/etc/redhat-release"})
|
||||||
runCmd.WaitWithDefaultTimeout()
|
runCmd.WaitWithDefaultTimeout()
|
||||||
Expect(runCmd).Should(Exit(0))
|
Expect(runCmd).Should(ExitCleanly())
|
||||||
Expect(runCmd.OutputToString()).To(ContainSubstring("Fedora"))
|
Expect(runCmd.OutputToString()).To(ContainSubstring("Fedora"))
|
||||||
|
|
||||||
rmCmd := podmanTest.Podman([]string{"rmi", "--force", fedoraMinimal})
|
rmCmd := podmanTest.Podman([]string{"rmi", "--force", fedoraMinimal})
|
||||||
rmCmd.WaitWithDefaultTimeout()
|
rmCmd.WaitWithDefaultTimeout()
|
||||||
Expect(rmCmd).Should(Exit(0))
|
Expect(rmCmd).Should(ExitCleanly())
|
||||||
|
|
||||||
psCmd := podmanTest.Podman([]string{"ps", "-aq"})
|
psCmd := podmanTest.Podman([]string{"ps", "-aq"})
|
||||||
psCmd.WaitWithDefaultTimeout()
|
psCmd.WaitWithDefaultTimeout()
|
||||||
Expect(psCmd).Should(Exit(0))
|
Expect(psCmd).Should(ExitCleanly())
|
||||||
Expect(psCmd.OutputToString()).To(BeEmpty())
|
Expect(psCmd.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
volumesCmd := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
volumesCmd := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
volumesCmd.WaitWithDefaultTimeout()
|
volumesCmd.WaitWithDefaultTimeout()
|
||||||
Expect(volumesCmd).Should(Exit(0))
|
Expect(volumesCmd).Should(ExitCleanly())
|
||||||
Expect(volumesCmd.OutputToString()).To(Not(ContainSubstring(volName)))
|
Expect(volumesCmd.OutputToString()).To(Not(ContainSubstring(volName)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -212,25 +212,25 @@ var _ = Describe("Podman volume create", func() {
|
||||||
volName := "testvol"
|
volName := "testvol"
|
||||||
volCreate := podmanTest.Podman([]string{"volume", "create", "--driver", "image", "--opt", fmt.Sprintf("image=%s", fedoraMinimal), volName})
|
volCreate := podmanTest.Podman([]string{"volume", "create", "--driver", "image", "--opt", fmt.Sprintf("image=%s", fedoraMinimal), volName})
|
||||||
volCreate.WaitWithDefaultTimeout()
|
volCreate.WaitWithDefaultTimeout()
|
||||||
Expect(volCreate).Should(Exit(0))
|
Expect(volCreate).Should(ExitCleanly())
|
||||||
|
|
||||||
runCmd := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "cat", "/test/etc/redhat-release"})
|
runCmd := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "cat", "/test/etc/redhat-release"})
|
||||||
runCmd.WaitWithDefaultTimeout()
|
runCmd.WaitWithDefaultTimeout()
|
||||||
Expect(runCmd).Should(Exit(0))
|
Expect(runCmd).Should(ExitCleanly())
|
||||||
Expect(runCmd.OutputToString()).To(ContainSubstring("Fedora"))
|
Expect(runCmd.OutputToString()).To(ContainSubstring("Fedora"))
|
||||||
|
|
||||||
rmCmd := podmanTest.Podman([]string{"volume", "rm", "--force", volName})
|
rmCmd := podmanTest.Podman([]string{"volume", "rm", "--force", volName})
|
||||||
rmCmd.WaitWithDefaultTimeout()
|
rmCmd.WaitWithDefaultTimeout()
|
||||||
Expect(rmCmd).Should(Exit(0))
|
Expect(rmCmd).Should(ExitCleanly())
|
||||||
|
|
||||||
psCmd := podmanTest.Podman([]string{"ps", "-aq"})
|
psCmd := podmanTest.Podman([]string{"ps", "-aq"})
|
||||||
psCmd.WaitWithDefaultTimeout()
|
psCmd.WaitWithDefaultTimeout()
|
||||||
Expect(psCmd).Should(Exit(0))
|
Expect(psCmd).Should(ExitCleanly())
|
||||||
Expect(psCmd.OutputToString()).To(BeEmpty())
|
Expect(psCmd.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
volumesCmd := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
volumesCmd := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
volumesCmd.WaitWithDefaultTimeout()
|
volumesCmd.WaitWithDefaultTimeout()
|
||||||
Expect(volumesCmd).Should(Exit(0))
|
Expect(volumesCmd).Should(ExitCleanly())
|
||||||
Expect(volumesCmd.OutputToString()).To(Not(ContainSubstring(volName)))
|
Expect(volumesCmd.OutputToString()).To(Not(ContainSubstring(volName)))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
"github.com/containers/storage/pkg/stringid"
|
"github.com/containers/storage/pkg/stringid"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
@ -17,11 +18,11 @@ var _ = Describe("Podman volume exists", func() {
|
||||||
vol := "vol" + stringid.GenerateRandomID()
|
vol := "vol" + stringid.GenerateRandomID()
|
||||||
session := podmanTest.Podman([]string{"volume", "create", vol})
|
session := podmanTest.Podman([]string{"volume", "create", vol})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "exists", vol})
|
session = podmanTest.Podman([]string{"volume", "exists", vol})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "exists", stringid.GenerateRandomID()})
|
session = podmanTest.Podman([]string{"volume", "exists", stringid.GenerateRandomID()})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman volume inspect", func() {
|
var _ = Describe("Podman volume inspect", func() {
|
||||||
|
|
@ -18,11 +17,11 @@ var _ = Describe("Podman volume inspect", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "inspect", volName})
|
session = podmanTest.Podman([]string{"volume", "inspect", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(BeValidJSON())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -30,11 +29,11 @@ var _ = Describe("Podman volume inspect", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", volName})
|
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(Equal(volName))
|
Expect(session.OutputToString()).To(Equal(volName))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -42,16 +41,16 @@ var _ = Describe("Podman volume inspect", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName1 := session.OutputToString()
|
volName1 := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
|
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
volName2 := session.OutputToString()
|
volName2 := session.OutputToString()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", "--all"})
|
session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", "--all"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
Expect(session.OutputToStringArray()[0]).To(Equal(volName1))
|
Expect(session.OutputToStringArray()[0]).To(Equal(volName1))
|
||||||
Expect(session.OutputToStringArray()[1]).To(Equal(volName2))
|
Expect(session.OutputToStringArray()[1]).To(Equal(volName2))
|
||||||
|
|
@ -61,11 +60,11 @@ var _ = Describe("Podman volume inspect", func() {
|
||||||
volName := "testvol"
|
volName := "testvol"
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", volName})
|
session := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
|
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(ExitCleanly())
|
||||||
Expect(inspect.OutputToString()).To(ContainSubstring(define.TypeTmpfs))
|
Expect(inspect.OutputToString()).To(ContainSubstring(define.TypeTmpfs))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman volume ls", func() {
|
var _ = Describe("Podman volume ls", func() {
|
||||||
|
|
@ -18,56 +17,56 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
It("podman ls volume", func() {
|
It("podman ls volume", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume filter with comma label", func() {
|
It("podman ls volume filter with comma label", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "test=with,comma", "myvol3"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "test=with,comma", "myvol3"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=test=with,comma"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=test=with,comma"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume filter with a key pattern", func() {
|
It("podman ls volume filter with a key pattern", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "helloworld=world", "myvol2"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "helloworld=world", "myvol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=hello*"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=hello*"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume with JSON format", func() {
|
It("podman ls volume with JSON format", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--format", "json"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--format", "json"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToString()).To(BeValidJSON())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume with Go template", func() {
|
It("podman ls volume with Go template", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--format", "table {{.Name}} {{.Driver}} {{.Scope}}"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--format", "table {{.Name}} {{.Driver}} {{.Scope}}"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
arr := session.OutputToStringArray()
|
arr := session.OutputToStringArray()
|
||||||
Expect(arr).To(HaveLen(2))
|
Expect(arr).To(HaveLen(2))
|
||||||
Expect(arr[0]).To(ContainSubstring("NAME"))
|
Expect(arr[0]).To(ContainSubstring("NAME"))
|
||||||
|
|
@ -78,48 +77,48 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "foo=bar", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "foo=bar", "myvol"})
|
||||||
volName := session.OutputToString()
|
volName := session.OutputToString()
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create"})
|
session = podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
|
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
|
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume with --filter until flag", func() {
|
It("podman ls volume with --filter until flag", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create"})
|
session := podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=5000000000"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=5000000000"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=50000"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=50000"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -127,25 +126,25 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
volName1 := "volume1"
|
volName1 := "volume1"
|
||||||
session := podmanTest.Podman([]string{"volume", "create", volName1})
|
session := podmanTest.Podman([]string{"volume", "create", volName1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
volName2 := "volume2"
|
volName2 := "volume2"
|
||||||
session2 := podmanTest.Podman([]string{"volume", "create", volName2})
|
session2 := podmanTest.Podman([]string{"volume", "create", volName2})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(ExitCleanly())
|
||||||
|
|
||||||
ctr := podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/test", volName2), ALPINE, "sh"})
|
ctr := podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/test", volName2), ALPINE, "sh"})
|
||||||
ctr.WaitWithDefaultTimeout()
|
ctr.WaitWithDefaultTimeout()
|
||||||
Expect(ctr).Should(Exit(0))
|
Expect(ctr).Should(ExitCleanly())
|
||||||
|
|
||||||
lsNoDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=false", "--quiet"})
|
lsNoDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=false", "--quiet"})
|
||||||
lsNoDangling.WaitWithDefaultTimeout()
|
lsNoDangling.WaitWithDefaultTimeout()
|
||||||
Expect(lsNoDangling).Should(Exit(0))
|
Expect(lsNoDangling).Should(ExitCleanly())
|
||||||
Expect(lsNoDangling.OutputToString()).To(ContainSubstring(volName2))
|
Expect(lsNoDangling.OutputToString()).To(ContainSubstring(volName2))
|
||||||
|
|
||||||
lsDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=true", "--quiet"})
|
lsDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=true", "--quiet"})
|
||||||
lsDangling.WaitWithDefaultTimeout()
|
lsDangling.WaitWithDefaultTimeout()
|
||||||
Expect(lsDangling).Should(Exit(0))
|
Expect(lsDangling).Should(ExitCleanly())
|
||||||
Expect(lsDangling.OutputToString()).To(ContainSubstring(volName1))
|
Expect(lsDangling.OutputToString()).To(ContainSubstring(volName1))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -153,28 +152,28 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
volName1 := "volume1"
|
volName1 := "volume1"
|
||||||
session := podmanTest.Podman([]string{"volume", "create", volName1})
|
session := podmanTest.Podman([]string{"volume", "create", volName1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
volName2 := "volume2"
|
volName2 := "volume2"
|
||||||
session2 := podmanTest.Podman([]string{"volume", "create", volName2})
|
session2 := podmanTest.Podman([]string{"volume", "create", volName2})
|
||||||
session2.WaitWithDefaultTimeout()
|
session2.WaitWithDefaultTimeout()
|
||||||
Expect(session2).Should(Exit(0))
|
Expect(session2).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volume1*"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volume1*"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(3))
|
Expect(session.OutputToStringArray()).To(HaveLen(3))
|
||||||
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName1))
|
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName1))
|
||||||
Expect(session.OutputToStringArray()[2]).To(ContainSubstring(volName2))
|
Expect(session.OutputToStringArray()[2]).To(ContainSubstring(volName2))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volumex"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volumex"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volume1"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "name=volume1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName1))
|
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName1))
|
||||||
})
|
})
|
||||||
|
|
@ -182,32 +181,32 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
It("podman ls volume with multiple --filter flag", func() {
|
It("podman ls volume with multiple --filter flag", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "a=b", "--label", "b=c", "vol1"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "a=b", "--label", "b=c", "vol1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
vol1Name := session.OutputToString()
|
vol1Name := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "b=c", "--label", "a=b", "vol2"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "b=c", "--label", "a=b", "vol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
vol2Name := session.OutputToString()
|
vol2Name := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "b=c", "--label", "c=d", "vol3"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "b=c", "--label", "c=d", "vol3"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
vol3Name := session.OutputToString()
|
vol3Name := session.OutputToString()
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "label=a=b", "--filter", "label=b=c"})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "label=a=b", "--filter", "label=b=c"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
Expect(session.OutputToStringArray()[0]).To(Equal(vol1Name))
|
Expect(session.OutputToStringArray()[0]).To(Equal(vol1Name))
|
||||||
Expect(session.OutputToStringArray()[1]).To(Equal(vol2Name))
|
Expect(session.OutputToStringArray()[1]).To(Equal(vol2Name))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "label=c=d", "--filter", "label=b=c"})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "label=c=d", "--filter", "label=b=c"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
Expect(session.OutputToStringArray()).To(HaveLen(1))
|
||||||
Expect(session.OutputToStringArray()[0]).To(Equal(vol3Name))
|
Expect(session.OutputToStringArray()[0]).To(Equal(vol3Name))
|
||||||
})
|
})
|
||||||
|
|
@ -219,15 +218,15 @@ var _ = Describe("Podman volume ls", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"volume", "create", vol1})
|
session := podmanTest.Podman([]string{"volume", "create", vol1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", vol2})
|
session = podmanTest.Podman([]string{"volume", "create", vol2})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", vol3})
|
session = podmanTest.Podman([]string{"volume", "create", vol3})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "since=" + vol1})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q", "--filter", "since=" + vol1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/containers/storage/pkg/stringid"
|
"github.com/containers/storage/pkg/stringid"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman volume plugins", func() {
|
var _ = Describe("Podman volume plugins", func() {
|
||||||
|
|
@ -49,7 +48,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
pluginName := "image"
|
pluginName := "image"
|
||||||
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -58,11 +57,11 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
volName := "testVolume1"
|
volName := "testVolume1"
|
||||||
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
ls1.WaitWithDefaultTimeout()
|
ls1.WaitWithDefaultTimeout()
|
||||||
Expect(ls1).Should(Exit(0))
|
Expect(ls1).Should(ExitCleanly())
|
||||||
arrOutput := ls1.OutputToStringArray()
|
arrOutput := ls1.OutputToStringArray()
|
||||||
Expect(arrOutput).To(HaveLen(1))
|
Expect(arrOutput).To(HaveLen(1))
|
||||||
Expect(arrOutput[0]).To(ContainSubstring(volName))
|
Expect(arrOutput[0]).To(ContainSubstring(volName))
|
||||||
|
|
@ -70,16 +69,16 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
// Verify this is not an image volume.
|
// Verify this is not an image volume.
|
||||||
inspect := podmanTest.Podman([]string{"volume", "inspect", volName, "--format", "{{.StorageID}}"})
|
inspect := podmanTest.Podman([]string{"volume", "inspect", volName, "--format", "{{.StorageID}}"})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(ExitCleanly())
|
||||||
Expect(inspect.OutputToString()).To(BeEmpty())
|
Expect(inspect.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
remove := podmanTest.Podman([]string{"volume", "rm", volName})
|
remove := podmanTest.Podman([]string{"volume", "rm", volName})
|
||||||
remove.WaitWithDefaultTimeout()
|
remove.WaitWithDefaultTimeout()
|
||||||
Expect(remove).Should(Exit(0))
|
Expect(remove).Should(ExitCleanly())
|
||||||
|
|
||||||
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
ls2.WaitWithDefaultTimeout()
|
ls2.WaitWithDefaultTimeout()
|
||||||
Expect(ls2).Should(Exit(0))
|
Expect(ls2).Should(ExitCleanly())
|
||||||
Expect(ls2.OutputToStringArray()).To(BeEmpty())
|
Expect(ls2.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -94,7 +93,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
pluginName := "testvol2"
|
pluginName := "testvol2"
|
||||||
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -103,11 +102,11 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
volName := "testVolume1"
|
volName := "testVolume1"
|
||||||
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Driver }}", volName})
|
volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Driver }}", volName})
|
||||||
volInspect.WaitWithDefaultTimeout()
|
volInspect.WaitWithDefaultTimeout()
|
||||||
Expect(volInspect).Should(Exit(0))
|
Expect(volInspect).Should(ExitCleanly())
|
||||||
Expect(volInspect.OutputToString()).To(ContainSubstring(pluginName))
|
Expect(volInspect.OutputToString()).To(ContainSubstring(pluginName))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -123,7 +122,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
ctrName := "pluginCtr"
|
ctrName := "pluginCtr"
|
||||||
plugin := podmanTest.Podman([]string{"run", "--name", ctrName, "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
plugin := podmanTest.Podman([]string{"run", "--name", ctrName, "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -132,18 +131,18 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
volName := "testVolume1"
|
volName := "testVolume1"
|
||||||
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
ls1 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
ls1.WaitWithDefaultTimeout()
|
ls1.WaitWithDefaultTimeout()
|
||||||
Expect(ls1).Should(Exit(0))
|
Expect(ls1).Should(ExitCleanly())
|
||||||
arrOutput := ls1.OutputToStringArray()
|
arrOutput := ls1.OutputToStringArray()
|
||||||
Expect(arrOutput).To(HaveLen(1))
|
Expect(arrOutput).To(HaveLen(1))
|
||||||
Expect(arrOutput[0]).To(ContainSubstring(volName))
|
Expect(arrOutput[0]).To(ContainSubstring(volName))
|
||||||
|
|
||||||
stop := podmanTest.Podman([]string{"stop", "--timeout", "0", ctrName})
|
stop := podmanTest.Podman([]string{"stop", "--timeout", "0", ctrName})
|
||||||
stop.WaitWithDefaultTimeout()
|
stop.WaitWithDefaultTimeout()
|
||||||
Expect(stop).Should(Exit(0))
|
Expect(stop).Should(ExitCleanly())
|
||||||
|
|
||||||
// Remove should exit non-zero because missing plugin
|
// Remove should exit non-zero because missing plugin
|
||||||
remove := podmanTest.Podman([]string{"volume", "rm", volName})
|
remove := podmanTest.Podman([]string{"volume", "rm", volName})
|
||||||
|
|
@ -153,7 +152,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
// But the volume should still be gone
|
// But the volume should still be gone
|
||||||
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
ls2.WaitWithDefaultTimeout()
|
ls2.WaitWithDefaultTimeout()
|
||||||
Expect(ls2).Should(Exit(0))
|
Expect(ls2).Should(ExitCleanly())
|
||||||
Expect(ls2.OutputToStringArray()).To(BeEmpty())
|
Expect(ls2.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -168,7 +167,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
pluginName := "testvol4"
|
pluginName := "testvol4"
|
||||||
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -177,17 +176,17 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
volName := "testVolume1"
|
volName := "testVolume1"
|
||||||
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
ctr1Name := "ctr1"
|
ctr1Name := "ctr1"
|
||||||
ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr1Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
|
ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr1Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
|
||||||
ctr1.WaitWithDefaultTimeout()
|
ctr1.WaitWithDefaultTimeout()
|
||||||
Expect(ctr1).Should(Exit(0))
|
Expect(ctr1).Should(ExitCleanly())
|
||||||
|
|
||||||
ctr2Name := "ctr2"
|
ctr2Name := "ctr2"
|
||||||
ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr2Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
|
ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr2Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
|
||||||
ctr2.WaitWithDefaultTimeout()
|
ctr2.WaitWithDefaultTimeout()
|
||||||
Expect(ctr2).Should(Exit(0))
|
Expect(ctr2).Should(ExitCleanly())
|
||||||
Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld"))
|
Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld"))
|
||||||
|
|
||||||
// HACK: `volume rm -f` is timing out trying to remove containers using the volume.
|
// HACK: `volume rm -f` is timing out trying to remove containers using the volume.
|
||||||
|
|
@ -195,7 +194,7 @@ var _ = Describe("Podman volume plugins", func() {
|
||||||
// TODO: fix this when I get back
|
// TODO: fix this when I get back
|
||||||
rmAll := podmanTest.Podman([]string{"rm", "-f", ctr2Name, ctr1Name})
|
rmAll := podmanTest.Podman([]string{"rm", "-f", ctr2Name, ctr1Name})
|
||||||
rmAll.WaitWithDefaultTimeout()
|
rmAll.WaitWithDefaultTimeout()
|
||||||
Expect(rmAll).Should(Exit(0))
|
Expect(rmAll).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman volume reload", func() {
|
It("podman volume reload", func() {
|
||||||
|
|
@ -218,7 +217,7 @@ testvol5 = "/run/docker/plugins/testvol5.sock"`), 0o644)
|
||||||
plugin := podmanTest.Podman([]string{"run", "--name", ctrName, "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins",
|
plugin := podmanTest.Podman([]string{"run", "--name", ctrName, "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins",
|
||||||
"-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
"-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -228,33 +227,33 @@ testvol5 = "/run/docker/plugins/testvol5.sock"`), 0o644)
|
||||||
// create local volume
|
// create local volume
|
||||||
session := podmanTest.Podman([]string{"volume", "create", localvol})
|
session := podmanTest.Podman([]string{"volume", "create", localvol})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
vol1 := "vol1-" + stringid.GenerateRandomID()
|
vol1 := "vol1-" + stringid.GenerateRandomID()
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, vol1})
|
session = podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, vol1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
// now create volume in plugin without podman
|
// now create volume in plugin without podman
|
||||||
vol2 := "vol2-" + stringid.GenerateRandomID()
|
vol2 := "vol2-" + stringid.GenerateRandomID()
|
||||||
plugin = podmanTest.Podman([]string{"exec", ctrName, "/usr/local/bin/testvol", "--sock-name", pluginName, "create", vol2})
|
plugin = podmanTest.Podman([]string{"exec", ctrName, "/usr/local/bin/testvol", "--sock-name", pluginName, "create", vol2})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElements(localvol, vol1))
|
Expect(session.OutputToStringArray()).To(ContainElements(localvol, vol1))
|
||||||
Expect(session.ErrorToString()).To(Equal("")) // make sure no errors are shown
|
Expect(session.ErrorToString()).To(Equal("")) // make sure no errors are shown
|
||||||
|
|
||||||
plugin = podmanTest.Podman([]string{"exec", ctrName, "/usr/local/bin/testvol", "--sock-name", pluginName, "remove", vol1})
|
plugin = podmanTest.Podman([]string{"exec", ctrName, "/usr/local/bin/testvol", "--sock-name", pluginName, "remove", vol1})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// now reload volumes from plugins
|
// now reload volumes from plugins
|
||||||
session = podmanTest.Podman([]string{"volume", "reload"})
|
session = podmanTest.Podman([]string{"volume", "reload"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
Expect(string(session.Out.Contents())).To(Equal(fmt.Sprintf(`Added:
|
Expect(string(session.Out.Contents())).To(Equal(fmt.Sprintf(`Added:
|
||||||
%s
|
%s
|
||||||
Removed:
|
Removed:
|
||||||
|
|
@ -264,7 +263,7 @@ Removed:
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(ContainElements(localvol, vol2))
|
Expect(session.OutputToStringArray()).To(ContainElements(localvol, vol2))
|
||||||
Expect(session.ErrorToString()).To(Equal("")) // make no errors are shown
|
Expect(session.ErrorToString()).To(Equal("")) // make no errors are shown
|
||||||
})
|
})
|
||||||
|
|
@ -280,7 +279,7 @@ Removed:
|
||||||
pluginName := "testvol6"
|
pluginName := "testvol6"
|
||||||
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
|
||||||
plugin.WaitWithDefaultTimeout()
|
plugin.WaitWithDefaultTimeout()
|
||||||
Expect(plugin).Should(Exit(0))
|
Expect(plugin).Should(ExitCleanly())
|
||||||
|
|
||||||
// Make sure the socket is available (see #17956)
|
// Make sure the socket is available (see #17956)
|
||||||
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
err = WaitForFile(fmt.Sprintf("/run/docker/plugins/%s.sock", pluginName))
|
||||||
|
|
@ -289,21 +288,21 @@ Removed:
|
||||||
volName := "testVolume1"
|
volName := "testVolume1"
|
||||||
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
|
||||||
create.WaitWithDefaultTimeout()
|
create.WaitWithDefaultTimeout()
|
||||||
Expect(create).Should(Exit(0))
|
Expect(create).Should(ExitCleanly())
|
||||||
|
|
||||||
volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName})
|
volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName})
|
||||||
volInspect.WaitWithDefaultTimeout()
|
volInspect.WaitWithDefaultTimeout()
|
||||||
Expect(volInspect).Should(Exit(0))
|
Expect(volInspect).Should(ExitCleanly())
|
||||||
Expect(volInspect.OutputToString()).To(ContainSubstring("15"))
|
Expect(volInspect.OutputToString()).To(ContainSubstring("15"))
|
||||||
|
|
||||||
volName2 := "testVolume2"
|
volName2 := "testVolume2"
|
||||||
create2 := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, "--opt", "o=timeout=3", volName2})
|
create2 := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, "--opt", "o=timeout=3", volName2})
|
||||||
create2.WaitWithDefaultTimeout()
|
create2.WaitWithDefaultTimeout()
|
||||||
Expect(create2).Should(Exit(0))
|
Expect(create2).Should(ExitCleanly())
|
||||||
|
|
||||||
volInspect2 := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName2})
|
volInspect2 := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName2})
|
||||||
volInspect2.WaitWithDefaultTimeout()
|
volInspect2.WaitWithDefaultTimeout()
|
||||||
Expect(volInspect2).Should(Exit(0))
|
Expect(volInspect2).Should(ExitCleanly())
|
||||||
Expect(volInspect2.OutputToString()).To(ContainSubstring("3"))
|
Expect(volInspect2.OutputToString()).To(ContainSubstring("3"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
. "github.com/onsi/gomega/gexec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Podman volume prune", func() {
|
var _ = Describe("Podman volume prune", func() {
|
||||||
|
|
@ -15,152 +15,152 @@ var _ = Describe("Podman volume prune", func() {
|
||||||
It("podman prune volume", func() {
|
It("podman prune volume", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create"})
|
session := podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create"})
|
session = podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman prune volume --filter until", func() {
|
It("podman prune volume --filter until", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=50"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=50"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
Expect(session.OutputToStringArray()).To(HaveLen(2))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=5000000000"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "until=5000000000"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman prune volume --filter", func() {
|
It("podman prune volume --filter", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
|
session := podmanTest.Podman([]string{"volume", "create", "--label", "label1=value1", "myvol1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv1", "myvol2"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv1", "myvol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv2", "myvol3"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1=slv2", "myvol3"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1", "myvol4"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "sharedlabel1", "myvol4"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "-v", "myvol5:/myvol5", ALPINE, "ls"})
|
session = podmanTest.Podman([]string{"create", "-v", "myvol5:/myvol5", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "-v", "myvol6:/myvol6", ALPINE, "ls"})
|
session = podmanTest.Podman([]string{"create", "-v", "myvol6:/myvol6", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(7))
|
Expect(session.OutputToStringArray()).To(HaveLen(7))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=label1=value1"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=label1=value1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(6))
|
Expect(session.OutputToStringArray()).To(HaveLen(6))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1=slv1"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1=slv1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
Expect(session.OutputToStringArray()).To(HaveLen(5))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label=sharedlabel1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(3))
|
Expect(session.OutputToStringArray()).To(HaveLen(3))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "--label", "testlabel", "myvol7"})
|
session = podmanTest.Podman([]string{"volume", "create", "--label", "testlabel", "myvol7"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label!=testlabel"})
|
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label!=testlabel"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman system prune --volume", func() {
|
It("podman system prune --volume", func() {
|
||||||
useCustomNetworkDir(podmanTest, tempdir)
|
useCustomNetworkDir(podmanTest, tempdir)
|
||||||
session := podmanTest.Podman([]string{"volume", "create"})
|
session := podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create"})
|
session = podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
Expect(session.OutputToStringArray()).To(HaveLen(4))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
|
session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -171,19 +171,19 @@ var _ = Describe("Podman volume prune", func() {
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"volume", "create", vol1})
|
session := podmanTest.Podman([]string{"volume", "create", vol1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", vol2})
|
session = podmanTest.Podman([]string{"volume", "create", vol2})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", vol3})
|
session = podmanTest.Podman([]string{"volume", "create", vol3})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "prune", "-f", "--filter", "since=" + vol1})
|
session = podmanTest.Podman([]string{"volume", "prune", "-f", "--filter", "since=" + vol1})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Exit(0))
|
Expect(session).To(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
session = podmanTest.Podman([]string{"volume", "ls", "-q"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,15 @@ var _ = Describe("Podman volume rm", func() {
|
||||||
It("podman volume rm", func() {
|
It("podman volume rm", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
|
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ var _ = Describe("Podman volume rm", func() {
|
||||||
session := podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
session := podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
|
session = podmanTest.Podman([]string{"volume", "rm", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -41,11 +41,11 @@ var _ = Describe("Podman volume rm", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "-t", "0", "-f", "myvol"})
|
session = podmanTest.Podman([]string{"volume", "rm", "-t", "0", "-f", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -58,45 +58,45 @@ var _ = Describe("Podman volume rm", func() {
|
||||||
It("podman rm with --all flag", func() {
|
It("podman rm with --all flag", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create"})
|
session = podmanTest.Podman([]string{"volume", "create"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "-a"})
|
session = podmanTest.Podman([]string{"volume", "rm", "-a"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman volume rm by partial name", func() {
|
It("podman volume rm by partial name", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
|
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(session.OutputToStringArray()).To(BeEmpty())
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman volume rm by nonunique partial name", func() {
|
It("podman volume rm by nonunique partial name", func() {
|
||||||
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
|
session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
|
session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
|
session = podmanTest.Podman([]string{"volume", "rm", "myv"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
@ -104,7 +104,7 @@ var _ = Describe("Podman volume rm", func() {
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "ls"})
|
session = podmanTest.Podman([]string{"volume", "ls"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(ExitCleanly())
|
||||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2))
|
Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue