mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-06-10 00:27:01 +00:00
b55ab5eef4
They now are running via a docker compose setup, which can be executed via ./php/tests/run.sh locally, and also gets called from the github workflow. Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
63 lines
1.9 KiB
Bash
Executable File
63 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [[ "$1" = -* ]]; then
|
|
echo "Usage $(basename $0) [PLAYWRIGHT_TESTS_FILE]"
|
|
exit 1
|
|
fi
|
|
|
|
cd $(dirname $0)/../..
|
|
|
|
DOCO="docker compose -f ./php/tests/compose.yaml"
|
|
|
|
if [[ $(uname -m) = 'arm64' ]]; then
|
|
export ARM64_SUFFIX='-arm64'
|
|
fi
|
|
|
|
run_tests() {
|
|
export TESTS_FILE="$1"
|
|
export SKIP_DOMAIN_VALIDATION
|
|
|
|
if [[ -n "$TEST_CODE_FROM_IMAGE" ]]; then
|
|
profile="code-from-image"
|
|
else
|
|
profile="local-code"
|
|
fi
|
|
|
|
# Clean up old containers and volumes
|
|
docker container rm --force nextcloud-aio-{mastercontainer,apache,notify-push,nextcloud,redis,database,domaincheck,whiteboard,imaginary,talk,collabora,borgbackup} > /dev/null 2>&1
|
|
docker volume rm nextcloud_aio_{mastercontainer,apache,database,database_dump,nextcloud,nextcloud_data,redis,backup_cache,elasticsearch} > /dev/null 2>&1
|
|
$DOCO --profile $profile down -v
|
|
sleep 1
|
|
|
|
echo -e "\n 📣 Running playwright tests for ${TESTS_FILE}\n"
|
|
if ! $DOCO --profile $profile run --remove-orphans test-runner-$profile; then
|
|
for container in nextcloud-aio-{mastercontainer,borgbackup}; do
|
|
if docker container list --format="{{ .Names }}" | grep -q "$container"; then
|
|
echo -e "\n 📣 Log output from container ${container}:\n"
|
|
docker logs nextcloud-aio-mastercontainer
|
|
fi
|
|
done
|
|
fi
|
|
}
|
|
|
|
|
|
if [[ -n "$1" ]]; then
|
|
if [[ ! -f "$1" ]]; then
|
|
echo "Error: file '$1' does not exist."
|
|
exit 1
|
|
fi
|
|
# Not using coreutil's `realpath --relative-to` here since that is not available on BSD/mac systems.
|
|
fullpath="$(realpath "$1")"
|
|
prefix="$(realpath ./php/tests)"
|
|
relpath="${fullpath#"$prefix"/}"
|
|
|
|
: ${SKIP_DOMAIN_VALIDATION:-false}
|
|
run_tests "$relpath"
|
|
else
|
|
SKIP_DOMAIN_VALIDATION=true
|
|
run_tests tests/initial-setup.spec.js
|
|
sleep 1
|
|
SKIP_DOMAIN_VALIDATION=false
|
|
run_tests tests/restore-instance.spec.js
|
|
fi
|