summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/benchmarks_test.go71
-rw-r--r--test/e2e/common_test.go34
-rw-r--r--test/e2e/container_clone_test.go26
-rw-r--r--test/e2e/info_test.go28
-rw-r--r--test/e2e/play_kube_test.go8
-rw-r--r--test/e2e/system_connection_test.go2
-rw-r--r--test/e2e/system_reset_test.go7
-rw-r--r--test/e2e/system_service_test.go18
8 files changed, 135 insertions, 59 deletions
diff --git a/test/e2e/benchmarks_test.go b/test/e2e/benchmarks_test.go
index 746dec0a6..ef4d51893 100644
--- a/test/e2e/benchmarks_test.go
+++ b/test/e2e/benchmarks_test.go
@@ -36,11 +36,14 @@ type benchmark struct {
options newBenchmarkOptions
}
+var benchmarkRegistry *podmanRegistry.Registry
+
// Allows for customizing the benchnmark in an easy to extend way.
type newBenchmarkOptions struct {
// Sets the benchmark's init function.
init func()
- // Run a local registry for this benchmark.
+ // Run a local registry for this benchmark. Use `getPortUserPass()` in
+ // the benchmark to get the port, user and password.
needsRegistry bool
}
@@ -53,6 +56,15 @@ func newBenchmark(name string, main func(), options *newBenchmarkOptions) {
allBenchmarks = append(allBenchmarks, bm)
}
+// getPortUserPass returns the port, user and password of the currently running
+// registry.
+func getPortUserPass() (string, string, string) {
+ if benchmarkRegistry == nil {
+ return "", "", ""
+ }
+ return benchmarkRegistry.Port, benchmarkRegistry.User, benchmarkRegistry.Password
+}
+
var _ = Describe("Podman Benchmark Suite", func() {
var (
timedir string
@@ -75,6 +87,15 @@ var _ = Describe("Podman Benchmark Suite", func() {
cleanup := func() {
podmanTest.Cleanup()
os.RemoveAll(timedir)
+
+ // Stop the local registry.
+ if benchmarkRegistry != nil {
+ if err := benchmarkRegistry.Stop(); err != nil {
+ logrus.Errorf("Error stopping registry: %v", err)
+ os.Exit(1)
+ }
+ benchmarkRegistry = nil
+ }
}
totalMemoryInKb := func() (total uint64) {
@@ -109,22 +130,23 @@ var _ = Describe("Podman Benchmark Suite", func() {
// All benchmarks are executed here to have *one* table listing all data.
Measure("Podman Benchmark Suite", func(b Benchmarker) {
+
+ registryOptions := &podmanRegistry.Options{
+ Image: "docker-archive:" + imageTarPath(registry),
+ }
+
for i := range allBenchmarks {
setup()
bm := allBenchmarks[i]
// Start a local registry if requested.
- var registry *podmanRegistry.Registry
if bm.options.needsRegistry {
- reg, err := podmanRegistry.Start()
+ reg, err := podmanRegistry.StartWithOptions(registryOptions)
if err != nil {
logrus.Errorf("Error starting registry: %v", err)
os.Exit(1)
}
- registry = reg
- os.Setenv(podmanRegistry.UserKey, reg.User)
- os.Setenv(podmanRegistry.PassKey, reg.Password)
- os.Setenv(podmanRegistry.PortKey, reg.Port)
+ benchmarkRegistry = reg
}
if bm.options.init != nil {
@@ -139,17 +161,6 @@ var _ = Describe("Podman Benchmark Suite", func() {
mem := totalMemoryInKb()
b.RecordValueWithPrecision("[MEM] "+bm.name, float64(mem), "KB", 1)
- // Stop the local registry.
- if bm.options.needsRegistry {
- os.Unsetenv(podmanRegistry.UserKey)
- os.Unsetenv(podmanRegistry.PassKey)
- os.Unsetenv(podmanRegistry.PortKey)
- if err := registry.Stop(); err != nil {
- logrus.Errorf("Error stopping registry: %v", err)
- os.Exit(1)
- }
- }
-
cleanup()
}
}, numBenchmarkSamples)
@@ -166,11 +177,27 @@ var _ = Describe("Podman Benchmark Suite", func() {
Expect(session).Should(Exit(0))
}, nil)
+ newBenchmark("podman push", func() {
+ port, user, pass := getPortUserPass()
+ session := podmanTest.Podman([]string{"push", "--tls-verify=false", "--creds", user + ":" + pass, UBI_INIT, "localhost:" + port + "/repo/image:tag"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ }, &newBenchmarkOptions{needsRegistry: true})
+
newBenchmark("podman pull", func() {
- session := podmanTest.Podman([]string{"pull", "quay.io/libpod/cirros"})
+ port, user, pass := getPortUserPass()
+ session := podmanTest.Podman([]string{"pull", "--tls-verify=false", "--creds", user + ":" + pass, "localhost:" + port + "/repo/image:tag"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- }, nil)
+ }, &newBenchmarkOptions{
+ needsRegistry: true,
+ init: func() {
+ port, user, pass := getPortUserPass()
+ session := podmanTest.Podman([]string{"push", "--tls-verify=false", "--creds", user + ":" + pass, UBI_INIT, "localhost:" + port + "/repo/image:tag"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ },
+ })
newBenchmark("podman load [docker]", func() {
session := podmanTest.Podman([]string{"load", "-i", "./testdata/docker-two-images.tar.xz"})
@@ -197,9 +224,7 @@ var _ = Describe("Podman Benchmark Suite", func() {
}, nil)
newBenchmark("podman login + logout", func() {
- user := os.Getenv(podmanRegistry.UserKey)
- pass := os.Getenv(podmanRegistry.PassKey)
- port := os.Getenv(podmanRegistry.PortKey)
+ port, user, pass := getPortUserPass()
session := podmanTest.Podman([]string{"login", "-u", user, "-p", pass, "--tls-verify=false", "localhost:" + port})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index a61ef8640..28991af7f 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"math/rand"
"net"
+ "net/url"
"os"
"os/exec"
"path/filepath"
@@ -1063,3 +1064,36 @@ func digShort(container, lookupName string, matchNames []string, p *PodmanTestIn
}
Fail("dns is not responding")
}
+
+// WaitForFile to be created in defaultWaitTimeout seconds, returns false if file not created
+func WaitForFile(path string) (err error) {
+ until := time.Now().Add(time.Duration(defaultWaitTimeout) * time.Second)
+ for i := 1; time.Now().Before(until); i++ {
+ _, err = os.Stat(path)
+ switch {
+ case err == nil:
+ return nil
+ case errors.Is(err, os.ErrNotExist):
+ time.Sleep(time.Duration(i) * time.Second)
+ default:
+ return err
+ }
+ }
+ return err
+}
+
+// WaitForService blocks, waiting for some service listening on given host:port
+func WaitForService(address url.URL) {
+ // Wait for podman to be ready
+ var conn net.Conn
+ var err error
+ for i := 1; i <= 5; i++ {
+ conn, err = net.Dial("tcp", address.Host)
+ if err != nil {
+ // Podman not available yet...
+ time.Sleep(time.Duration(i) * time.Second)
+ }
+ }
+ Expect(err).ShouldNot(HaveOccurred())
+ conn.Close()
+}
diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go
index da9b511e0..94ccd6ffe 100644
--- a/test/e2e/container_clone_test.go
+++ b/test/e2e/container_clone_test.go
@@ -266,4 +266,30 @@ var _ = Describe("Podman container clone", func() {
Expect(clone).ToNot(Exit(0))
})
+
+ It("podman container clone network passing", func() {
+ networkCreate := podmanTest.Podman([]string{"network", "create", "testing123"})
+ networkCreate.WaitWithDefaultTimeout()
+ defer podmanTest.removeNetwork("testing123")
+ Expect(networkCreate).To(Exit(0))
+ run := podmanTest.Podman([]string{"run", "--network", "bridge", "-dt", ALPINE})
+ run.WaitWithDefaultTimeout()
+ Expect(run).To(Exit(0))
+
+ connect := podmanTest.Podman([]string{"network", "connect", "testing123", run.OutputToString()})
+ connect.WaitWithDefaultTimeout()
+ Expect(connect).To(Exit(0))
+
+ clone := podmanTest.Podman([]string{"container", "clone", run.OutputToString()})
+ clone.WaitWithDefaultTimeout()
+ Expect(clone).To(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", clone.OutputToString()})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.InspectContainerToJSON()[0].NetworkSettings.Networks).To(HaveLen(2))
+ _, ok := inspect.InspectContainerToJSON()[0].NetworkSettings.Networks["testing123"]
+ Expect(ok).To(BeTrue())
+
+ })
})
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index f989a9d29..2c2c82cb6 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -119,33 +119,31 @@ var _ = Describe("Podman Info", func() {
Expect(string(out)).To(Equal(expect))
})
- It("podman info check RemoteSocket", func() {
+ It("check RemoteSocket ", func() {
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.RemoteSocket.Path}}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(MatchRegexp("/run/.*podman.*sock"))
- if IsRemote() {
- session = podmanTest.Podman([]string{"info", "--format", "{{.Host.RemoteSocket.Exists}}"})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(ContainSubstring("true"))
+ session = podmanTest.Podman([]string{"info", "--format", "{{.Host.ServiceIsRemote}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ if podmanTest.RemoteTest {
+ Expect(session.OutputToString()).To(Equal("true"))
+ } else {
+ Expect(session.OutputToString()).To(Equal("false"))
}
- })
- It("verify ServiceIsRemote", func() {
- session := podmanTest.Podman([]string{"info", "--format", "{{.Host.ServiceIsRemote}}"})
+ session = podmanTest.Podman([]string{"info", "--format", "{{.Host.RemoteSocket.Exists}}"})
session.WaitWithDefaultTimeout()
- Expect(session).To(Exit(0))
-
- if podmanTest.RemoteTest {
+ Expect(session).Should(Exit(0))
+ if IsRemote() {
Expect(session.OutputToString()).To(ContainSubstring("true"))
- } else {
- Expect(session.OutputToString()).To(ContainSubstring("false"))
}
+
})
- It("Podman info must contain cgroupControllers with ReleventControllers", func() {
+ It("Podman info must contain cgroupControllers with RelevantControllers", func() {
SkipIfRootless("Hard to tell which controllers are going to be enabled for rootless")
SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users")
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.CgroupControllers}}"})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 0e91db04c..45414ec04 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -3180,8 +3180,10 @@ invalid kube kind
Expect(ls).Should(Exit(0))
Expect(ls.OutputToStringArray()).To(HaveLen(1))
- containerLen := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{len .Containers}}'"})
-
+ containerLen := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "{{len .Containers}}"})
+ containerLen.WaitWithDefaultTimeout()
+ Expect(containerLen).Should(Exit(0))
+ Expect(containerLen.OutputToString()).To(Equal("2"))
ctr01Name := "ctr01"
ctr02Name := "ctr02"
@@ -3199,7 +3201,7 @@ invalid kube kind
replace.WaitWithDefaultTimeout()
Expect(replace).Should(Exit(0))
- newContainerLen := podmanTest.Podman([]string{"pod", "inspect", newPod.Name, "--format", "'{{len .Containers}}'"})
+ newContainerLen := podmanTest.Podman([]string{"pod", "inspect", newPod.Name, "--format", "{{len .Containers}}"})
newContainerLen.WaitWithDefaultTimeout()
Expect(newContainerLen).Should(Exit(0))
Expect(newContainerLen.OutputToString()).NotTo(Equal(containerLen.OutputToString()))
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index 95920136e..2228c23b2 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -247,7 +247,7 @@ var _ = Describe("podman system connection", func() {
// podman-remote commands will be executed by ginkgo directly.
SkipIfContainerized("sshd is not available when running in a container")
SkipIfRemote("connection heuristic requires both podman and podman-remote binaries")
- SkipIfNotRootless("FIXME: setup ssh keys when root")
+ SkipIfNotRootless(fmt.Sprintf("FIXME: setup ssh keys when root. uid(%d) euid(%d)", os.Getuid(), os.Geteuid()))
SkipIfSystemdNotRunning("cannot test connection heuristic if systemd is not running")
SkipIfNotActive("sshd", "cannot test connection heuristic if sshd is not running")
})
diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go
index ec94bb819..28f2e25ca 100644
--- a/test/e2e/system_reset_test.go
+++ b/test/e2e/system_reset_test.go
@@ -89,5 +89,12 @@ var _ = Describe("podman system reset", func() {
Expect(session).Should(Exit(0))
// default network should exists
Expect(session.OutputToStringArray()).To(HaveLen(1))
+
+ // TODO: machine tests currently don't run outside of the machine test pkg
+ // no machines are created here to cleanup
+ session = podmanTest.Podman([]string{"machine", "list", "-q"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToStringArray()).To(BeEmpty())
})
})
diff --git a/test/e2e/system_service_test.go b/test/e2e/system_service_test.go
index 2bc7756d6..398290426 100644
--- a/test/e2e/system_service_test.go
+++ b/test/e2e/system_service_test.go
@@ -20,7 +20,7 @@ var _ = Describe("podman system service", func() {
// The timeout used to for the service to respond. As shown in #12167,
// this may take some time on machines under high load.
- var timeout = 20
+ var timeout = 30
BeforeEach(func() {
tempdir, err := CreateTempDirInTempDir()
@@ -122,22 +122,6 @@ var _ = Describe("podman system service", func() {
})
})
-// WaitForService blocks, waiting for some service listening on given host:port
-func WaitForService(address url.URL) {
- // Wait for podman to be ready
- var conn net.Conn
- var err error
- for i := 1; i <= 5; i++ {
- conn, err = net.Dial("tcp", address.Host)
- if err != nil {
- // Podman not available yet...
- time.Sleep(time.Duration(i) * time.Second)
- }
- }
- Expect(err).ShouldNot(HaveOccurred())
- conn.Close()
-}
-
// randomPort leans on the go net library to find an available port...
func randomPort() string {
port, err := utils.GetRandomPort()