diff --git a/forgejo/upgrades/fixtures.sh b/forgejo/upgrades/fixtures.sh index 1b8cb44..335b53c 100644 --- a/forgejo/upgrades/fixtures.sh +++ b/forgejo/upgrades/fixtures.sh @@ -12,11 +12,29 @@ function fixture_get_paths_s3() { local path=$1 ( - echo -n $path/ - mc ls --quiet --recursive testS3/$path | sed -e 's/.* //' + mc ls --quiet --recursive testS3/$path | sed -e "s|.* |$path/|" ) > $DIR/path } +function fixture_content_search_s3() { + local path="$1" + local expected="$2" + + fixture_get_paths_s3 $path + if test $(wc -l < $DIR/path) -lt 1 ; then + echo expected at least one but got "'$(cat $DIR/path)'" + return 1 + fi + for filename in $(cat $DIR/path) ; do + local content=$(mc cat testS3/$filename | base64 -w0) + if test "$content" = "$expected" ; then + return 0 + fi + done + echo nothing in $path found with the expected content "$expected" + return 1 +} + function fixture_get_paths_local() { local path=$1 local work_path=$DIR/forgejo-work-path @@ -101,9 +119,7 @@ function fixture_avatars_create() { } function fixture_avatars_assert_s3() { - local filename=$(fixture_get_one_path s3 forgejo/avatars) - local content=$(mc cat testS3/$filename | base64 -w0) - test "$content" = "$ONEPIXEL" + fixture_content_search_s3 forgejo/avatars "$ONEPIXEL" } function fixture_avatars_assert_local() {