summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at2
-rw-r--r--test/apiv2/40-pods.at24
-rwxr-xr-xtest/apiv2/test-apiv230
-rw-r--r--test/e2e/common_test.go2
-rw-r--r--test/e2e/generate_systemd_test.go14
-rw-r--r--test/e2e/run_volume_test.go2
-rw-r--r--test/endpoint/endpoint.go2
-rw-r--r--test/endpoint/setup.go14
8 files changed, 56 insertions, 34 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 3a5d5a398..7fb39b221 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -11,7 +11,7 @@ podman pull $IMAGE &>/dev/null
# Ensure clean slate
podman rm -a -f &>/dev/null
-t GET libpod/containers/json 200 length=0
+t GET "libpod/containers/json (at start: clean slate)" 200 length=0
podman run $IMAGE true
diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at
index 70d9f8203..982100396 100644
--- a/test/apiv2/40-pods.at
+++ b/test/apiv2/40-pods.at
@@ -3,7 +3,8 @@
# test pod-related endpoints
#
-t GET libpod/pods/json 200 null
+t GET "libpod/pods/json (clean slate at start)" 200 null
+
t POST libpod/pods/create name=foo 201 .id~[0-9a-f]\\{64\\}
pod_id=$(jq -r .id <<<"$output")
t GET libpod/pods/foo/exists 204
@@ -19,7 +20,8 @@ t GET libpod/pods/json 200 \
.[0].Containers\|length=1
# Cannot create a dup pod with the same name
-t POST libpod/pods/create name=foo 409 .cause="pod already exists"
+t POST "libpod/pods/create (dup pod)" name=foo 409 \
+ .cause="pod already exists"
#t POST libpod/pods/create a=b 400 .cause='bad parameter' # FIXME: unimplemented
@@ -27,16 +29,18 @@ if root || have_cgroupsv2; then
t POST libpod/pods/foo/pause '' 200
else
# Rootless cgroupsv1 : unsupported
- t POST libpod/pods/foo/pause '' 500 \
+ t POST "libpod/pods/foo/pause (rootless cgroups v1)" '' 500 \
.cause="this container does not have a cgroup" \
.message~".*pause pods containing rootless containers with cgroup V1"
fi
-t POST libpod/pods/foo/unpause '' 200
-t POST libpod/pods/foo/unpause '' 200 # (2nd time)
-t POST libpod/pods/foo/stop '' 304
-t POST libpod/pods/foo/restart '' 200
+t POST libpod/pods/foo/unpause '' 200
+t POST "libpod/pods/foo/unpause (2nd unpause in a row)" '' 200
+t POST "libpod/pods/foo/stop (pod is already stopped)" '' 304
+t POST libpod/pods/foo/restart '' 200 \
+ .Errs=null \
+ .Id=$pod_id
-t POST libpod/pods/bar/restart '' 404
+t POST "libpod/pods/bar/restart (restart on nonexistent pod)" '' 404
# FIXME: I'm not sure what 'prune' is supposed to do; as of 20200224 it
# just returns 200 (ok) with empty result list.
@@ -44,7 +48,7 @@ t POST libpod/pods/bar/restart '' 404
#t POST libpod/pods/prune 'a=b' 400 # FIXME: 2020-02-24 returns 200
# Clean up; and try twice, making sure that the second time fails
-t DELETE libpod/pods/foo 200
-t DELETE libpod/pods/foo 404
+t DELETE libpod/pods/foo 200
+t DELETE "libpod/pods/foo (pod has already been deleted)" 404
# vim: filetype=sh
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index f0fb4ae34..b101be012 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -24,8 +24,10 @@ IMAGE=$PODMAN_TEST_IMAGE_FQN
TMPDIR=${TMPDIR:-/tmp}
WORKDIR=$(mktemp --tmpdir -d $ME.tmp.XXXXXX)
-# Log of all HTTP requests and responses
-LOG=${TMPDIR}/$ME.log.$(date +'%Y%m%dT%H%M%S')
+# Log of all HTTP requests and responses; always make '.log' point to latest
+LOGBASE=${TMPDIR}/$ME.log
+LOG=${LOGBASE}.$(date +'%Y%m%dT%H%M%S')
+ln -sf $LOG $LOGBASE
HOST=localhost
PORT=${PODMAN_SERVICE_PORT:-8081}
@@ -110,17 +112,21 @@ function _show_ok() {
_bump $testcounter_file
count=$(<$testcounter_file)
if [ $ok -eq 1 ]; then
- echo -e "${green}ok $count $testname${reset}"
+ echo -e "${green}ok $count ${TEST_CONTEXT} $testname${reset}"
+ echo "ok $count ${TEST_CONTEXT} $testname" >>$LOG
return
fi
# Failed
local expect=$3
local actual=$4
- echo -e "${red}not ok $count $testname${reset}"
+ echo -e "${red}not ok $count ${TEST_CONTEXT} $testname${reset}"
echo -e "${red}# expected: $expect${reset}"
echo -e "${red}# actual: ${bold}$actual${reset}"
+ echo "not ok $count ${TEST_CONTEXT} $testname" >>$LOG
+ echo " expected: $expect"
+
_bump $failures_file
}
@@ -168,6 +174,10 @@ function t() {
testname="$testname [$1]"
shift
fi
+
+ # entrypoint path can include a descriptive comment; strip it off
+ path=${path%% *}
+
# curl -X HEAD but without --head seems to wait for output anyway
if [[ $method == "HEAD" ]]; then
curl_args="--head"
@@ -196,13 +206,20 @@ function t() {
exit 1
fi
- cat $WORKDIR/curl.headers.out $WORKDIR/curl.result.out >>$LOG 2>/dev/null || true
+ cat $WORKDIR/curl.headers.out >>$LOG 2>/dev/null || true
+ output=$(< $WORKDIR/curl.result.out)
+
+ # Log results. If JSON, filter through jq for readability
+ if egrep -qi '^Content-Type: application/json' $WORKDIR/curl.headers.out; then
+ jq . <<<"$output" >>$LOG
+ else
+ echo "$output" >>$LOG
+ fi
# Test return code
actual_code=$(head -n1 $WORKDIR/curl.headers.out | awk '/^HTTP/ { print $2}')
is "$actual_code" "$expected_code" "$testname : status"
- output=$(< $WORKDIR/curl.result.out)
# Special case: 204/304, by definition, MUST NOT return content (rfc2616)
if [[ $expected_code = 204 || $expected_code = 304 ]]; then
@@ -327,6 +344,7 @@ fi
start_service
for i in ${tests_to_run[@]}; do
+ TEST_CONTEXT="[$(basename $i .at)]"
source $i
done
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index b10c3237d..8c4fe9223 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -431,7 +431,7 @@ func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegrat
// Cleanup cleans up the temporary store
func (p *PodmanTestIntegration) Cleanup() {
// Remove all containers
- stopall := p.Podman([]string{"stop", "-a", "--timeout", "0"})
+ stopall := p.Podman([]string{"stop", "-a", "--time", "0"})
stopall.Wait(90)
podstop := p.Podman([]string{"pod", "stop", "-a", "-t", "0"})
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index e5ab0b854..abfca4db9 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -47,7 +47,7 @@ var _ = Describe("Podman generate systemd", func() {
})
It("podman generate systemd bad timeout value", func() {
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "-1", "foobar"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "-1", "foobar"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
})
@@ -57,7 +57,7 @@ var _ = Describe("Podman generate systemd", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"generate", "systemd", "--timeout", "1234", "foobar"})
+ session = podmanTest.Podman([]string{"generate", "systemd", "--time", "1234", "foobar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -97,7 +97,7 @@ var _ = Describe("Podman generate systemd", func() {
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "5", "nginx"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "5", "nginx"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -118,7 +118,7 @@ var _ = Describe("Podman generate systemd", func() {
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "42", "--name", "foo"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -183,7 +183,7 @@ var _ = Describe("Podman generate systemd", func() {
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "42", "--name", "--new", "foo"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "-t", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -214,7 +214,7 @@ var _ = Describe("Podman generate systemd", func() {
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "42", "--name", "--new", "foo"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -228,7 +228,7 @@ var _ = Describe("Podman generate systemd", func() {
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"generate", "systemd", "--timeout", "42", "--name", "--new", "foo"})
+ session := podmanTest.Podman([]string{"generate", "systemd", "--time", "42", "--name", "--new", "foo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index e31338dbc..667f03627 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -255,7 +255,7 @@ var _ = Describe("Podman run with volumes", func() {
Expect(strings.Contains(mountOut2, volName)).To(BeTrue())
// Stop the container to unmount
- podmanStopSession := podmanTest.Podman([]string{"stop", "--timeout", "0", ctrName})
+ podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
podmanStopSession.WaitWithDefaultTimeout()
Expect(podmanStopSession.ExitCode()).To(Equal(0))
diff --git a/test/endpoint/endpoint.go b/test/endpoint/endpoint.go
index 5b5484865..f1677ec5f 100644
--- a/test/endpoint/endpoint.go
+++ b/test/endpoint/endpoint.go
@@ -11,8 +11,8 @@ import (
"syscall"
"time"
- iopodman "github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/pkg/rootless"
+ iopodman "github.com/containers/libpod/pkg/varlink"
. "github.com/onsi/ginkgo"
"github.com/onsi/gomega/gexec"
)
diff --git a/test/endpoint/setup.go b/test/endpoint/setup.go
index 727f29ec6..11fa77b5c 100644
--- a/test/endpoint/setup.go
+++ b/test/endpoint/setup.go
@@ -8,8 +8,8 @@ import (
"path/filepath"
"strings"
- iopodman "github.com/containers/libpod/cmd/podman/varlink"
"github.com/containers/libpod/pkg/rootless"
+ iopodman "github.com/containers/libpod/pkg/varlink"
"github.com/containers/storage/pkg/stringid"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -90,7 +90,7 @@ func Setup(tempDir string) *EndpointTestIntegration {
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
StorageOptions: storageOptions,
TmpDir: tempDir,
- //Timings: nil,
+ // Timings: nil,
VarlinkBinary: VarlinkBinary,
VarlinkCommand: nil,
VarlinkEndpoint: endpoint,
@@ -105,7 +105,7 @@ func (p *EndpointTestIntegration) Cleanup() {
p.stopAllContainers()
- //TODO need to make stop all pods
+ // TODO need to make stop all pods
p.StopVarlink()
// Nuke tempdir
@@ -153,9 +153,9 @@ func (p *EndpointTestIntegration) createArtifact(image string) {
Expect(pull.ExitCode()).To(Equal(0))
imageSave := iopodman.ImageSaveOptions{
- //Name:image,
- //Output: destName,
- //Format: "oci-archive",
+ // Name:image,
+ // Output: destName,
+ // Format: "oci-archive",
}
imageSave.Name = image
imageSave.Output = destName
@@ -186,7 +186,7 @@ func (p *EndpointTestIntegration) RestoreArtifactToCache(image string) error {
fmt.Printf("Restoring %s...\n", image)
dest := strings.Split(image, "/")
destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- //fmt.Println(destName, p.ImageCacheDir)
+ // fmt.Println(destName, p.ImageCacheDir)
load := p.Varlink("LoadImage", fmt.Sprintf("{\"name\": \"%s\", \"inputFile\": \"%s\"}", image, destName), false)
Expect(load.ExitCode()).To(BeZero())
return nil