@cryptotaxi247 / kubo / commits / 9a9ec021c

test(sharness): add gateway symlink test

Steven Allen committed Sep 26, 2019 at 14:10 UTC 9a9ec021cf886e752eaf29cfccf8d6c08b39f0a5
1 file changed +38
test/sharness/t0113-gateway-symlink.sh new
+38
@@ -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