-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tar cat
should return appropriate headers
License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
- Loading branch information
1 parent
cdddf0f
commit fc41e1d
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
test_description="Test tar cat headers" | ||
|
||
test_tar_cat_headers() { | ||
mkdir foo && | ||
random 10000 > foo/a && | ||
random 12345 > foo/b && | ||
mkdir foo/bar && | ||
random 5432 > foo/bar/baz && | ||
ln -s ../a foo/bar/link && | ||
echo "exit" > foo/script && | ||
chmod +x foo/script | ||
tar cf files.tar foo/ | ||
TAR_HASH=$(ipfs tar add files.tar) | ||
mkdir output && | ||
ipfs tar cat $TAR_HASH > output/out.tar | ||
} | ||
|
||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
test_tar_cat_headers | ||
test_launch_ipfs_daemon | ||
|
||
gwport=$GWAY_PORT | ||
apiport=$API_PORT | ||
|
||
# Gateway | ||
|
||
# HTTP GET Request | ||
test_expect_success "GET to Gateway succeeds" ' | ||
curl -svX GET "http://127.0.0.1:$gwport/api/v0/tar/cat?arg=$TAR_HASH" 2>curl_output | ||
' | ||
# GET Response from Gateway should contain correct content type | ||
test_expect_success "GET response for Gateway resource looks good" ' | ||
grep "application:x-tar" curl_output | ||
' | ||
|
||
test_kill_ipfs_daemon | ||
|
||
test_done |