Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(fixtures): support fixtures on macOS #200

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading