test(fixtures): support `fixtures` on `macOS` (#200)

* test: support fixtures for macOS

* chore: clarify the comment

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
This commit is contained in:
Artem Medvedev 2023-12-10 16:04:28 +01:00 committed by GitHub
parent 3e34206884
commit adbd67a182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,7 @@ setup() {
run_test() {
file_url=$(curl -s -F "file=@file" -H "expire:1s" localhost:8000)
test "$content" = "$(cat upload/file.txt.*)"
sleep 2s
sleep 2
result="$(curl -s $file_url)"
test "file is not found or expired :(" = "$result"

View File

@ -10,7 +10,7 @@ setup() {
run_test() {
seq $file_count | xargs -I -- curl -s -F "file=@file" -H "Authorization: $auth_token" localhost:8000 >/dev/null
test "$file_count" = "$(curl -s -H "Authorization: $auth_token" localhost:8000/list | grep -o 'file_name' | wc -l)"
test $file_count = $(curl -s -H "Authorization: $auth_token" localhost:8000/list | grep -o 'file_name' | wc -l)
test "unauthorized" = "$(curl -s localhost:8000/list)"
}

View File

@ -11,10 +11,10 @@ run_test() {
second_file_url=$(curl -s -F "file=@file" -H "expire:4s" localhost:8000)
test "$content" = "$(curl -s $first_file_url)"
test "$content" = "$(curl -s $second_file_url)"
sleep 3s
sleep 3
test "file is not found or expired :(" = "$(curl -s $first_file_url)"
test "$content" = "$(curl -s $second_file_url)"
sleep 1s
sleep 1
test "file is not found or expired :(" = "$(curl -s $second_file_url)"
}

View File

@ -3,7 +3,8 @@
setup() {
touch emptyfile
truncate -s 9KB smallfile
fallocate -l 10000 normalfile
# On Linux, `fallocate -l 10000 normalfile` can be used for a better precision.
dd if=/dev/random of=normalfile count=10000 bs=1024 status=none
truncate -s 11KB bigfile
}