diff options
-rw-r--r-- | .cirrus.yml | 5 | ||||
-rw-r--r-- | cmd/podman/main.go | 2 | ||||
-rw-r--r-- | libpod/container_internal.go | 4 | ||||
-rw-r--r-- | test/e2e/checkpoint_test.go | 9 | ||||
-rw-r--r-- | test/e2e/common_test.go | 14 | ||||
-rw-r--r-- | test/e2e/create_staticip_test.go | 10 | ||||
-rw-r--r-- | test/e2e/run_staticip_test.go | 10 | ||||
-rw-r--r-- | test/e2e/version_test.go | 21 |
8 files changed, 50 insertions, 25 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 78b00c879..faa0a531c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -23,7 +23,6 @@ env: CIRRUS_SHELL: "/bin/bash" # Save a little typing (path relative to $CIRRUS_WORKING_DIR) SCRIPT_BASE: "./contrib/cirrus" - CIRRUS_CLONE_DEPTH: 50 # Command to prefix output lines with timing information # (can't do inline awk script, Cirrus-CI or YAML mangles quoting) TIMESTAMP: "awk --file ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/timestamp.awk" @@ -206,7 +205,7 @@ build_each_commit_task: build_each_commit_script: # set -x by default, no need to spew contents of lib.sh - 'source $SCRIPT_BASE/lib.sh &> /dev/null' - - 'git fetch --depth $CIRRUS_CLONE_DEPTH origin $DEST_BRANCH |& ${TIMESTAMP}' + - 'git fetch --depth 50 origin $DEST_BRANCH |& ${TIMESTAMP}' - 'make build-all-new-commits GIT_BASE_BRANCH=origin/$DEST_BRANCH |& ${TIMESTAMP}' on_failure: @@ -269,7 +268,6 @@ meta_task: GCPJSON: ENCRYPTED[950d9c64ad78f7b1f0c7e499b42dc058d2b23aa67e38b315e68f557f2aba0bf83068d4734f7b1e1bdd22deabe99629df] GCPNAME: ENCRYPTED[b05d469a0dba8cb479cb00cc7c1f6747c91d17622fba260a986b976aa6c817d4077eacffd4613d6d5f23afc4084fab1d] GCPPROJECT: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f] - CIRRUS_CLONE_DEPTH: 1 # source not used timeout_in: 10m @@ -550,7 +548,6 @@ release_task: timeout_in: 30m env: - CIRRUS_CLONE_DEPTH: 1 # source is not used, only Makefile GCPJSON: ENCRYPTED[789d8f7e9a5972ce350fd8e60f1032ccbf4a35c3938b604774b711aad280e12c21faf10e25af1e0ba33597ffb9e39e46] GCPNAME: ENCRYPTED[417d50488a4bd197bcc925ba6574de5823b97e68db1a17e3a5fde4bcf26576987345e75f8d9ea1c15a156b4612c072a1] GCPROJECT: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f] diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 72d1754ac..1b54c9458 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -91,7 +91,7 @@ func init() { rootCmd.Version = version.Version // Override default --help information of `--version` global flag var dummyVersion bool - rootCmd.PersistentFlags().BoolVar(&dummyVersion, "version", false, "Version for podman") + rootCmd.Flags().BoolVarP(&dummyVersion, "version", "v", false, "Version of podman") rootCmd.AddCommand(mainCommands...) rootCmd.AddCommand(getMainCommands()...) } diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 36732685b..83ee5640e 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1474,10 +1474,6 @@ func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (exten } else { manager, err := hooks.New(ctx, c.runtime.config.HooksDir, []string{"precreate", "poststop"}) if err != nil { - if os.IsNotExist(err) { - logrus.Warnf("Requested OCI hooks directory %q does not exist", c.runtime.config.HooksDir) - return nil, nil - } return nil, err } diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index b77c48c8e..8f3cf5c10 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -3,12 +3,9 @@ package integration import ( - "math/rand" "net" "os" "os/exec" - "strconv" - "time" "github.com/containers/libpod/pkg/criu" . "github.com/containers/libpod/test/utils" @@ -17,12 +14,8 @@ import ( ) func getRunString(input []string) []string { - // To avoid IP collisions of initialize random seed for random IP addresses - rand.Seed(time.Now().UnixNano()) - ip3 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) - ip4 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) // CRIU does not work with seccomp correctly on RHEL7 : seccomp=unconfined - runString := []string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", "--ip", "10.88." + ip3 + "." + ip4} + runString := []string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", "--ip", GetRandomIPAddress()} return append(runString, input...) } diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 7e14f9e06..22eb94972 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -4,10 +4,12 @@ import ( "encoding/json" "fmt" "io/ioutil" + "math/rand" "os" "os/exec" "path/filepath" "sort" + "strconv" "strings" "testing" "time" @@ -339,6 +341,18 @@ func GetPortLock(port string) storage.Locker { return lock } +// GetRandomIPAddress returns a random IP address to avoid IP +// collisions during parallel tests +func GetRandomIPAddress() string { + // To avoid IP collisions of initialize random seed for random IP addresses + rand.Seed(time.Now().UnixNano()) + // Add GinkgoParallelNode() on top of the IP address + // in case of the same random seed + ip3 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) + ip4 := strconv.Itoa(rand.Intn(230) + GinkgoParallelNode()) + return "10.88." + ip3 + "." + ip4 +} + // RunTopContainer runs a simple container in the background that // runs top. If the name passed != "", it will have a name func (p *PodmanTestIntegration) RunTopContainer(name string) *PodmanSessionIntegration { diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go index 11301856b..709e56665 100644 --- a/test/e2e/create_staticip_test.go +++ b/test/e2e/create_staticip_test.go @@ -60,7 +60,8 @@ var _ = Describe("Podman create with --ip flag", func() { }) It("Podman create with specified static IP has correct IP", func() { - result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) @@ -71,14 +72,15 @@ var _ = Describe("Podman create with --ip flag", func() { result = podmanTest.Podman([]string{"logs", "test"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - Expect(result.OutputToString()).To(ContainSubstring("10.88.64.128/16")) + Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) }) It("Podman create two containers with the same IP", func() { - result := podmanTest.Podman([]string{"create", "--name", "test1", "--ip", "10.88.64.128", ALPINE, "sleep", "999"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"create", "--name", "test1", "--ip", ip, ALPINE, "sleep", "999"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - result = podmanTest.Podman([]string{"create", "--name", "test2", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + result = podmanTest.Podman([]string{"create", "--name", "test2", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) result = podmanTest.Podman([]string{"start", "test1"}) diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index b9698cdd9..7a877ebdc 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -56,17 +56,19 @@ var _ = Describe("Podman run with --ip flag", func() { }) It("Podman run with specified static IP has correct IP", func() { - result := podmanTest.Podman([]string{"run", "-ti", "--ip", "10.88.63.2", ALPINE, "ip", "addr"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - Expect(result.OutputToString()).To(ContainSubstring("10.88.63.2/16")) + Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) }) It("Podman run two containers with the same IP", func() { - result := podmanTest.Podman([]string{"run", "-d", "--ip", "10.88.64.128", ALPINE, "sleep", "999"}) + ip := GetRandomIPAddress() + result := podmanTest.Podman([]string{"run", "-d", "--ip", ip, ALPINE, "sleep", "999"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) - result = podmanTest.Podman([]string{"run", "-ti", "--ip", "10.88.64.128", ALPINE, "ip", "addr"}) + result = podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).ToNot(Equal(0)) }) diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index 2c8b3068c..0db2e2cf2 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -4,6 +4,7 @@ import ( "os" . "github.com/containers/libpod/test/utils" + "github.com/containers/libpod/version" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -37,6 +38,26 @@ var _ = Describe("Podman version", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2)) + ok, _ := session.GrepString(version.Version) + Expect(ok).To(BeTrue()) + }) + + It("podman -v", func() { + SkipIfRemote() + session := podmanTest.Podman([]string{"-v"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + ok, _ := session.GrepString(version.Version) + Expect(ok).To(BeTrue()) + }) + + It("podman --version", func() { + SkipIfRemote() + session := podmanTest.Podman([]string{"--version"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + ok, _ := session.GrepString(version.Version) + Expect(ok).To(BeTrue()) }) It("podman version --format json", func() { |