Skip to content

Commit 1ff0515

Browse files
committed
test(sharness): add gateway symlink test
1 parent fae96bb commit 1ff0515

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) Protocol Labs
4+
5+
test_description="Test symlink support on the HTTP gateway"
6+
7+
. lib/test-lib.sh
8+
9+
test_init_ipfs
10+
test_launch_ipfs_daemon
11+
12+
13+
test_expect_success "Create a test directory with symlinks" '
14+
mkdir testfiles &&
15+
echo "content" > testfiles/foo &&
16+
ln -s foo testfiles/bar &&
17+
test_cmp testfiles/foo testfiles/bar
18+
'
19+
20+
test_expect_success "Add the test directory" '
21+
HASH=$(ipfs add -Qr testfiles)
22+
'
23+
24+
test_expect_success "Test the directory listing" '
25+
curl "$GWAY_ADDR/ipfs/$HASH" > list_response &&
26+
test_should_contain ">foo<" list_response &&
27+
test_should_contain ">bar<" list_response
28+
'
29+
30+
test_expect_success "Test the symlink" '
31+
curl "$GWAY_ADDR/ipfs/$HASH/bar" > bar_actual &&
32+
echo -n "foo" > bar_expected &&
33+
test_cmp bar_expected bar_actual
34+
'
35+
36+
test_kill_ipfs_daemon
37+
38+
test_done

0 commit comments

Comments
 (0)