diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/12-imagesMore.at | 5 | ||||
-rw-r--r-- | test/apiv2/python/conftest.py | 8 | ||||
-rw-r--r-- | test/apiv2/python/requirements.txt | 5 | ||||
-rwxr-xr-x | test/apiv2/test-apiv2 | 19 | ||||
-rw-r--r-- | test/e2e/containers_conf_test.go | 5 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 20 | ||||
-rw-r--r-- | test/system/070-build.bats | 24 |
7 files changed, 78 insertions, 8 deletions
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at index 96eba1db5..67b4f1c79 100644 --- a/test/apiv2/12-imagesMore.at +++ b/test/apiv2/12-imagesMore.at @@ -26,7 +26,8 @@ t GET libpod/images/$IMAGE/json 200 \ .RepoTags[1]=localhost:5000/myrepo:mytag # Run registry container -podman run -d --name registry -p 5000:5000 quay.io/libpod/registry:2.6 /entrypoint.sh /etc/docker/registry/config.yml +# FIXME this fails if python tests have been run first... +podman run -d --name registry -p 5000:5000 quay.io/libpod/registry:2.7 /entrypoint.sh /etc/docker/registry/config.yml wait_for_port localhost 5000 # Push to local registry and check output @@ -58,7 +59,7 @@ t DELETE libpod/containers/registry?force=true 200 # Remove images t DELETE libpod/images/$IMAGE 200 \ .ExitCode=0 -t DELETE libpod/images/quay.io/libpod/registry:2.6 200 \ +t DELETE libpod/images/quay.io/libpod/registry:2.7 200 \ .ExitCode=0 if [ -z "${GOT_DIGEST}" ] ; then diff --git a/test/apiv2/python/conftest.py b/test/apiv2/python/conftest.py new file mode 100644 index 000000000..54a267049 --- /dev/null +++ b/test/apiv2/python/conftest.py @@ -0,0 +1,8 @@ +""" +Configure pytest +""" + + +def pytest_report_header(config): + """Add header to report.""" + return "python client -- requests library" diff --git a/test/apiv2/python/requirements.txt b/test/apiv2/python/requirements.txt new file mode 100644 index 000000000..d9cfc687a --- /dev/null +++ b/test/apiv2/python/requirements.txt @@ -0,0 +1,5 @@ +requests-mock~=1.9.3 +requests~=2.20.0 +setuptools~=50.3.2 +python-dateutil~=2.8.1 +PyYAML~=5.4.1 diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index bd728e130..ff328cfc8 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -368,7 +368,7 @@ function start_service() { die "Cannot start service on non-localhost ($HOST)" fi - echo $WORKDIR + echo "rootdir: "$WORKDIR # Some tests use shortnames; force registry override to work around # docker.io throttling. # FIXME esm revisit pulling expected images re: shortnames caused tests to fail @@ -376,7 +376,7 @@ function start_service() { $PODMAN_BIN \ --root $WORKDIR/server_root --syslog=true \ system service \ - --time 15 \ + --time 0 \ tcp:127.0.0.1:$PORT \ &> $WORKDIR/server.log & service_pid=$! @@ -443,7 +443,7 @@ function start_registry() { -e REGISTRY_HTTP_TLS_KEY=/auth/domain.key \ ${REGISTRY_IMAGE} - wait_for_port localhost $REGISTRY_PORT + wait_for_port localhost $REGISTRY_PORT 10 } function stop_registry() { @@ -492,13 +492,16 @@ function wait_for_port() { local port=$2 # Numeric port local _timeout=${3:-5} # Optional; default to 5 seconds + local path=/dev/tcp/$host/$port + # Wait - while [ $_timeout -gt 0 ]; do + local i=$_timeout + while [ $i -gt 0 ]; do { exec 3<> /dev/tcp/$host/$port; } &>/dev/null && return sleep 1 - _timeout=$(( $_timeout - 1 )) + i=$(( $i - 1 )) done - die "Timed out waiting for service" + die "Timed out (${_timeout}s) waiting for service ($path)" } ############ @@ -543,6 +546,9 @@ done ############################################################################### # BEGIN entry handler (subtest invoker) +echo '============================= test session starts ==============================' +echo "podman client -- $(curl --version)" + # Identify the tests to run. If called with args, use those as globs. tests_to_run=() if [ -n "$*" ]; then @@ -558,6 +564,7 @@ if [ -n "$*" ]; then else tests_to_run=($TESTS_DIR/*.at) fi +echo -e "collected ${#tests_to_run[@]} items\n" start_service diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index bfed01854..09cd68042 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -562,6 +562,11 @@ var _ = Describe("Verify podman containers.conf usage", func() { inspect = podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.Cgroups }}", result.OutputToString()}) inspect.WaitWithDefaultTimeout() Expect(inspect.OutputToString()).To(Equal("disabled")) + + // Check we can also create a pod when cgroups=disabled + result = podmanTest.Podman([]string{"pod", "create"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) }) It("podman containers.conf runtime", func() { diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 9b1e0c74b..6a4083565 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1888,6 +1888,26 @@ var _ = Describe("Podman play kube", func() { Expect(kube).Should(Exit(0)) }) + It("podman play kube test duplicate container name", func() { + p := getPod(withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "hello"}))), withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "world"})))) + + err := generateKubeYaml("pod", p, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).To(ExitWithError()) + + p = getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("initctr"))), withCtr(getCtr(withImage(ALPINE), withName("initctr"), withCmd([]string{"top"})))) + + err = generateKubeYaml("pod", p, kubeYaml) + Expect(err).To(BeNil()) + + kube = podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube).To(ExitWithError()) + }) + It("podman play kube test hostname", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) diff --git a/test/system/070-build.bats b/test/system/070-build.bats index c963d8325..e47d66542 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -210,6 +210,30 @@ EOF run_podman rmi -f build_test } +@test "podman parallel build should not race" { + skip_if_remote "following test is not supported for remote clients" + + # Run thirty parallel builds using the same Containerfile + cat >$PODMAN_TMPDIR/Containerfile <<EOF +FROM $IMAGE +RUN echo hi +EOF + + local count=30 + for i in $(seq --format '%02g' 1 $count); do + timeout --foreground -v --kill=10 60 \ + $PODMAN build -t i$i $PODMAN_TMPDIR &>/dev/null & + done + + # Wait for all background builds to complete. Note that this succeeds + # even if some of the individual builds fail! Our actual test is below. + wait + + # Now delete all built images. If any image wasn't built, rmi will fail + # and test will fail. + run_podman rmi $(seq --format 'i%02g' 1 $count) +} + @test "podman build - URLs" { tmpdir=$PODMAN_TMPDIR/build-test mkdir -p $tmpdir |