Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Jan 30, 2023
1 parent 43ee915 commit 7455b64
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
4 changes: 2 additions & 2 deletions test/tests/plone-arbitrary-user/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ get() {
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}


Expand Down
4 changes: 2 additions & 2 deletions test/tests/plone-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ get() {
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}


Expand Down
2 changes: 1 addition & 1 deletion test/tests/plone-develop/expected-std-out.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=======================================================================================
Installing DEVELOPment addons /app/src/helloworld
THIS IS NOT MEANT TO BE USED IN PRODUCTION
Read about it: https://github.com/plone/plone-backend/#extending-from-this-image
Read about it: https://6.docs.plone.org/install/containers/images/backend.html
=======================================================================================
Hello World!
26 changes: 26 additions & 0 deletions test/tests/plone-listenport/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -eo pipefail

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

image="$1"

PLONE_TEST_SLEEP=3
PLONE_TEST_TRIES=5

cname="plone-container-$RANDOM-$RANDOM"
cid="$(docker run -d --name "$cname" -e LISTEN_PORT=8081 "$image")"
trap "docker rm -vf $cid > /dev/null" EXIT

get() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8081"

# Plone is up and running
[[ "$(get 'http://plone:8081')" == *"Plone is up and running"* ]]
4 changes: 2 additions & 2 deletions test/tests/plone-relstorage/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ get() {
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"
Expand Down
4 changes: 2 additions & 2 deletions test/tests/plone-shared-blob-dir/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ get() {
--link "${pname}":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "${pname}":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"
Expand Down
6 changes: 3 additions & 3 deletions test/tests/plone-site/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ get() {
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}


. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get "http://plone:8080/$site/en")" == *"English"* ]]
[[ "$(get "http://plone:8080/$site")" == *"Welcome to Plone"* ]]
4 changes: 2 additions & 2 deletions test/tests/plone-zeoclient/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ get() {
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from six.moves.urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"
Expand Down

0 comments on commit 7455b64

Please sign in to comment.