summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/manifest_test.go11
-rw-r--r--test/e2e/mount_test.go3
-rw-r--r--test/e2e/network_test.go132
-rw-r--r--test/e2e/run_memory_test.go1
-rw-r--r--test/e2e/run_security_labels.go4
-rw-r--r--test/e2e/run_test.go6
6 files changed, 78 insertions, 79 deletions
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 33aac48d5..b85132814 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman manifest", func() {
@@ -49,6 +50,16 @@ var _ = Describe("Podman manifest", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman manifest inspect", func() {
+ session := podmanTest.Podman([]string{"manifest", "inspect", BB})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.PodmanNoCache([]string{"manifest", "inspect", "docker.io/library/busybox"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ })
+
It("podman manifest add", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index ee2753d72..4223961a6 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -189,7 +189,6 @@ var _ = Describe("Podman mount", func() {
})
It("podman list running container", func() {
- SkipIfRootless("FIXME: We need to do a podman unshare before executing this code.")
setup := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
@@ -212,7 +211,6 @@ var _ = Describe("Podman mount", func() {
})
It("podman list multiple mounted containers", func() {
- SkipIfRootless("FIXME: We need to do a podman unshare before executing this code.")
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
@@ -257,7 +255,6 @@ var _ = Describe("Podman mount", func() {
})
It("podman list mounted container", func() {
- SkipIfRootless("FIXME: We need to do a podman unshare before executing this code.")
setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
setup.WaitWithDefaultTimeout()
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index aae82e292..a15359ea3 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -25,6 +25,42 @@ func removeConf(confPath string) {
}
}
+// generateNetworkConfig generates a cni config with a random name
+// it returns the network name and the filepath
+func generateNetworkConfig(p *PodmanTestIntegration) (string, string) {
+ // generate a random name to preven conflicts with other tests
+ name := "net" + stringid.GenerateNonCryptoID()
+ path := filepath.Join(p.CNIConfigDir, fmt.Sprintf("%s.conflist", name))
+ conf := fmt.Sprintf(`{
+ "cniVersion": "0.3.0",
+ "name": "%s",
+ "plugins": [
+ {
+ "type": "bridge",
+ "bridge": "cni1",
+ "isGateway": true,
+ "ipMasq": true,
+ "ipam": {
+ "type": "host-local",
+ "subnet": "10.99.0.0/16",
+ "routes": [
+ { "dst": "0.0.0.0/0" }
+ ]
+ }
+ },
+ {
+ "type": "portmap",
+ "capabilities": {
+ "portMappings": true
+ }
+ }
+ ]
+ }`, name)
+ writeConf([]byte(conf), path)
+
+ return name, path
+}
+
var _ = Describe("Podman network", func() {
var (
tempdir string
@@ -48,84 +84,44 @@ var _ = Describe("Podman network", func() {
})
- var (
- secondConf = `{
- "cniVersion": "0.3.0",
- "name": "podman-integrationtest",
- "plugins": [
- {
- "type": "bridge",
- "bridge": "cni1",
- "isGateway": true,
- "ipMasq": true,
- "ipam": {
- "type": "host-local",
- "subnet": "10.99.0.0/16",
- "routes": [
- { "dst": "0.0.0.0/0" }
- ]
- }
- },
- {
- "type": "portmap",
- "capabilities": {
- "portMappings": true
- }
- }
- ]
-}`
- )
-
It("podman network list", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
session := podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
+ Expect(session.LineInOutputContains(name)).To(BeTrue())
})
It("podman network list -q", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
+ Expect(session.LineInOutputContains(name)).To(BeTrue())
})
It("podman network list --filter success", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
+ Expect(session.LineInOutputContains(name)).To(BeTrue())
})
It("podman network list --filter failure", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=test"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOutputContains("podman-integrationtest")).To(BeFalse())
+ Expect(session.LineInOutputContains(name)).To(BeFalse())
})
It("podman network rm no args", func() {
@@ -135,25 +131,23 @@ var _ = Describe("Podman network", func() {
})
It("podman network rm", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ SkipIfRootless("FIXME: This one is definitely broken in rootless mode")
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
+ Expect(session.LineInOutputContains(name)).To(BeTrue())
- rm := podmanTest.Podman([]string{"network", "rm", "podman-integrationtest"})
+ rm := podmanTest.Podman([]string{"network", "rm", name})
rm.WaitWithDefaultTimeout()
Expect(rm.ExitCode()).To(BeZero())
results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(results.LineInOutputContains("podman-integrationtest")).To(BeFalse())
+ Expect(results.LineInOutputContains(name)).To(BeFalse())
})
It("podman network inspect no args", func() {
@@ -163,13 +157,10 @@ var _ = Describe("Podman network", func() {
})
It("podman network inspect", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
- expectedNetworks := []string{"podman-integrationtest"}
+ expectedNetworks := []string{name}
if !rootless.IsRootless() {
// rootful image contains "podman/cni/87-podman-bridge.conflist" for "podman" network
expectedNetworks = append(expectedNetworks, "podman")
@@ -181,13 +172,10 @@ var _ = Describe("Podman network", func() {
})
It("podman network inspect", func() {
- // Setup, use uuid to prevent conflict with other tests
- uuid := stringid.GenerateNonCryptoID()
- secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid))
- writeConf([]byte(secondConf), secondPath)
- defer removeConf(secondPath)
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
- session := podmanTest.Podman([]string{"network", "inspect", "podman-integrationtest", "--format", "{{.cniVersion}}"})
+ session := podmanTest.Podman([]string{"network", "inspect", name, "--format", "{{.cniVersion}}"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContains("0.3.0")).To(BeTrue())
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index fa19b1824..b3913c1e6 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -18,7 +18,6 @@ var _ = Describe("Podman run memory", func() {
BeforeEach(func() {
SkipIfRootlessCgroupsV1("Setting Memory not supported on cgroupv1 for rootless users")
- SkipIfRootless("FIXME: This should work on cgroups V2 systems")
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/run_security_labels.go b/test/e2e/run_security_labels.go
index 7c8597866..2a0b0467d 100644
--- a/test/e2e/run_security_labels.go
+++ b/test/e2e/run_security_labels.go
@@ -130,7 +130,7 @@ var _ = Describe("Podman generate kube", func() {
SkipIfRemote("runlabel not supported on podman-remote")
PodmanDockerfile := `
FROM alpine:latest
-LABEL io.containers.capabilities=chown,mknod`
+LABEL io.containers.capabilities=chown,kill`
image := "podman-caps:podman"
podmanTest.BuildImage(PodmanDockerfile, image, "false")
@@ -145,7 +145,7 @@ LABEL io.containers.capabilities=chown,mknod`
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
- Expect(caps).To(Equal("CAP_CHOWN,CAP_MKNOD"))
+ Expect(caps).To(Equal("CAP_CHOWN,CAP_KILL"))
})
})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 2d4f3a42d..292df529c 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -261,6 +261,8 @@ var _ = Describe("Podman run", func() {
})
It("podman run user capabilities test", func() {
+ // We need to ignore the containers.conf on the test distribution for this test
+ os.Setenv("CONTAINERS_CONF", "/dev/null")
session := podmanTest.Podman([]string{"run", "--rm", "--user", "bin", ALPINE, "grep", "CapBnd", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -293,6 +295,8 @@ var _ = Describe("Podman run", func() {
})
It("podman run user capabilities test with image", func() {
+ // We need to ignore the containers.conf on the test distribution for this test
+ os.Setenv("CONTAINERS_CONF", "/dev/null")
SkipIfRemote("FIXME This should work on podman-remote")
dockerfile := `FROM busybox
USER bin`
@@ -1134,7 +1138,7 @@ USER mail`
It("podman run --device-cgroup-rule", func() {
SkipIfRootless("rootless users are not allowed to mknod")
deviceCgroupRule := "c 42:* rwm"
- session := podmanTest.Podman([]string{"run", "--name", "test", "-d", "--device-cgroup-rule", deviceCgroupRule, ALPINE, "top"})
+ session := podmanTest.Podman([]string{"run", "--cap-add", "mknod", "--name", "test", "-d", "--device-cgroup-rule", deviceCgroupRule, ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"exec", "test", "mknod", "newDev", "c", "42", "1"})