Skip to content

Commit

Permalink
test(fixtures): support fixtures on macOS (#200)
Browse files Browse the repository at this point in the history
* test: support fixtures for macOS

* chore: clarify the comment

Co-authored-by: Orhun Parmaksız <[email protected]>

---------

Co-authored-by: Orhun Parmaksız <[email protected]>
  • Loading branch information
DDtKey and orhun authored Dec 10, 2023
1 parent 3e34206 commit adbd67a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fixtures/test-expiring-file-upload/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion fixtures/test-list-files/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}

Expand Down
4 changes: 2 additions & 2 deletions fixtures/test-server-auto-deletion/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}

Expand Down
3 changes: 2 additions & 1 deletion fixtures/test-server-payload-limit/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit adbd67a

Please sign in to comment.