Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fczuardi committed Feb 7, 2024
1 parent 30e57c9 commit 348a461
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
39 changes: 27 additions & 12 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ if [ -z "$CONFIG_YAML_CONTENT" ]; then
exit 1
fi

# set machine timezone to Sao Paulo
timedatectl set-timezone America/Sao_Paulo

# simple text file with date for the nginx to serve
printf ":-)\n\n$(date)\n" > /app/results/smile.txt

Expand All @@ -25,15 +22,33 @@ remotes=$(dasel -f /app/config.yaml -r yaml -s '.remotes.all().key()' | tr '\n'

echo "Remotes: $remotes"

# tries a list-buckets on each remote
for remote in $remotes; do
echo "$remote:" >> /app/results/smile.txt
echo "Executing AWS CLI list-buckets for profile $remote"
aws s3api list-buckets --cli-connect-timeout 10 --cli-read-timeout 10 --profile "$remote" >> /app/results/smile.txt
done

# Create a cron job that runs every 3 minutes
echo "*/3 * * * * /app/run_tests.sh" > /etc/crontabs/root
# # tries a list-buckets on each remote
# for remote in $remotes; do
# echo "$remote:" >> /app/results/smile.txt
# echo "Executing AWS CLI list-buckets for profile $remote"
# aws s3api list-buckets --cli-connect-timeout 10 --cli-read-timeout 10 --profile "$remote" >> /app/results/smile.txt
# done

#debug commands
echo "-----"
echo "tree output"
tree
echo "just output"
just
echo "available tests:"
just list-tests
touch /app/results/2
mkdir -p results/foo/bar
echo "-----"

# run a small test (delete-objects) on all remotes to assure that the reports are being written in the correct place
just group-test delete-objects _all "$remotes"

# Create a cron job that runs every 20 minutes
echo "*/20 * * * * /app/run_tests.sh" > /etc/crontabs/root

# debug crontab
printf "\n$(crontab -l)" >> /app/results/smile.txt

# Start cron
crond -f &
Expand Down
8 changes: 7 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/sh
set +x

touch /app/results/debug_run_tests_start

# space separated list of remote names
remotes=$(dasel -f /app/config.yaml -r yaml -s '.remotes.all().key()' | tr '\n' ' ')

echo $remotes > /app/results/debug_run_tests_remotes_list

test_out=$(just group-test delete-objects _all "$remotes")

touch /app/results/debug_run_tests_end

chmod -R 755 /app/results

# simple text file with date for the nginx to serve
printf ":-)\n\nLatest test $(date)\n$(test_out)" > /app/results/smile.txt
printf ":-)\n\nLatest test $(date)\n$test_out\n$remotes" > /app/results/smile.txt
6 changes: 5 additions & 1 deletion webapp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ FROM ghcr.io/marmotitude/object-storage-tests:main

# Install Nginx and cron
RUN apk update && \
apk add --no-cache nginx dcron
apk add --no-cache nginx dcron tzdata

# Set the timezone to America/Sao_Paulo
RUN ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime && \
echo "America/Sao_Paulo" > /etc/timezone

# Keep a backup of alpine's default nginx config
RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
Expand Down

0 comments on commit 348a461

Please sign in to comment.