Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 20, 2025
1 parent 5f9c10f commit ad0c79f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions test-checks
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
docker compose exec -T \
--user weblate \
weblate weblate check --deploy --fail-level WARNING
--user weblate \
weblate weblate check --deploy --fail-level WARNING
4 changes: 2 additions & 2 deletions test-commands
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
docker compose exec -T \
--user weblate \
weblate licensee --help
--user weblate \
weblate licensee --help
8 changes: 4 additions & 4 deletions test-content
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

STORAGE=$(mktemp)
cleanup() {
rm "$STORAGE"
rm "$STORAGE"
}
trap cleanup EXIT

echo "Creating container..."
docker create --name="tmp_$$" "${TEST_CONTAINER:-weblate/weblate:edge}"
echo "Listing content container..."
docker export tmp_$$ | tar t > "$STORAGE"
docker export tmp_$$ | tar t >"$STORAGE"
echo "Removing container..."
docker rm tmp_$$
echo "Checking content..."

# /app/data is not checked because it contains stub for customization
if grep -E '^(app/cache|tmp|run)/.+' "$STORAGE"; then
echo "Volumes contain files!"
exit 1
echo "Volumes contain files!"
exit 1
fi

echo "$STORAGE"
30 changes: 15 additions & 15 deletions test-generate
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
if [ "$3" = "saml" ]; then
TEST_EXTRA_ENV='WEBLATE_SAML_IDP_URL: https://example.com/idp'
TEST_EXTRA_ENV='WEBLATE_SAML_IDP_URL: https://example.com/idp'
elif [ "$3" = "celery-single" ]; then
TEST_EXTRA_ENV='CELERY_SINGLE_PROCESS: 1'
TEST_EXTRA_ENV='CELERY_SINGLE_PROCESS: 1'
else
TEST_EXTRA_ENV=''
TEST_EXTRA_ENV=''
fi

cat > docker-compose.override.yml << EOT
cat >docker-compose.override.yml <<EOT
services:
weblate:
image: ${TEST_CONTAINER:-weblate/weblate:edge}
Expand All @@ -23,34 +23,34 @@ services:
EOT

if [ "$3" = "split" ]; then
mv docker-compose-split.yml docker-compose.yml
for service in celery-backup celery-beat celery-celery celery-memory celery-notify celery-translate; do
cat >> docker-compose.override.yml << EOT
mv docker-compose-split.yml docker-compose.yml
for service in celery-backup celery-beat celery-celery celery-memory celery-notify celery-translate; do
cat >>docker-compose.override.yml <<EOT
weblate-${service}:
image: ${TEST_CONTAINER:-weblate/weblate:edge}
restart: no
environment:
WEBLATE_TIME_ZONE: Europe/Prague
WEBLATE_SITE_DOMAIN: test.example.com
EOT
done
done
fi
if [ "$3" = "read-write" ] || [ "$3" = "localtime" ]; then
sed -i -e '/tmpfs:/D' -e '/- \/run/D' -e '/- \/tmp/D' -e '/read_only: true/D' docker-compose.yml
if [ "$3" = "localtime" ]; then
sed -i -e '/weblate-cache:\/app\/cache/a\
sed -i -e '/tmpfs:/D' -e '/- \/run/D' -e '/- \/tmp/D' -e '/read_only: true/D' docker-compose.yml
if [ "$3" = "localtime" ]; then
sed -i -e '/weblate-cache:\/app\/cache/a\
- /etc/localtime:/etc/localtime:ro' docker-compose.yml
fi
fi
else
# Allow execution in tmp
sed -i 's/- \/tmp/- \/tmp:exec/' docker-compose.yml
# Allow execution in tmp
sed -i 's/- \/tmp/- \/tmp:exec/' docker-compose.yml
fi

IP=127.0.0.1
PORT=${1:-8080}
PROTO=${2:-http}

cat > .test.env << EOT
cat >.test.env <<EOT
URL=$PROTO://$IP:$PORT/
EOT

Expand Down
4 changes: 2 additions & 2 deletions test-health
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
docker compose ps
docker compose exec -T \
--user weblate \
weblate /app/bin/health_check
--user weblate \
weblate /app/bin/health_check
12 changes: 6 additions & 6 deletions test-online
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
echo "Checking $URL..."
TIMEOUT=0
while ! curl --insecure --fail --max-time 5 --silent --output /dev/null "$URL"; do
sleep 5
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 300 ]; then
break
fi
sleep 5
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 300 ]; then
break
fi
done
curl --insecure --verbose --fail --max-time 3 "${URL}about/" | grep 'Powered by.*Weblate'
RET=$?
Expand All @@ -18,5 +18,5 @@ RET2=$?
docker compose logs

if [ $RET2 -ne 0 ] || [ $RET -ne 0 ]; then
exit 1
exit 1
fi
4 changes: 2 additions & 2 deletions test-saml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
if [ "$1" = "saml" ]; then
docker compose exec -T weblate openssl x509 -in /app/data/ssl/saml.crt -text -noout
docker compose exec -T weblate openssl x509 -in /app/data/ssl/saml.crt -text -noout
else
docker compose exec -T weblate test ! -f /app/data/ssl/saml.crt
docker compose exec -T weblate test ! -f /app/data/ssl/saml.crt
fi
4 changes: 2 additions & 2 deletions test-supervisor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ docker compose exec -T weblate supervisorctl status all
RET=$?
# The 3 happens with EXITED check and supervisor 4
if [ $RET -ne 0 ] && [ $RET -ne 3 ]; then
docker compose logs
exit 1
docker compose logs
exit 1
fi

0 comments on commit ad0c79f

Please sign in to comment.