Skip to content

Commit 0a7c2c0

Browse files
committed
test(alias): add test cases
1 parent 6c1211b commit 0a7c2c0

27 files changed

+36
-1
lines changed

test/case/004.alias.bash

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source "$root"/lib.bash
44

5-
"$ghfs" -l 3003 -r "$fs"/vhost1 -a :world/go:"$fs"/vhost1/go :/not/exist/name:"$fs"/vhost1/yes -E '' &
5+
"$ghfs" -l 3003 -r "$fs"/vhost1 -a :world/go:"$fs"/vhost1/go :/not/exist/name:"$fs"/vhost1/yes -a :/foo:"$fs"/vhost2/a -a :/foo/bar/baz:"$fs"/vhost2/b -E '' &
66
sleep 0.05 # wait server ready
77

88
file1=$(curl_get_body http://127.0.0.1:3003/file1.txt)
@@ -23,4 +23,13 @@ assert "$status" '404'
2323
yes=$(curl_get_body http://127.0.0.1:3003/not/exist/name/index.txt)
2424
assert "$yes" 'vhost1/yes/index.txt'
2525

26+
a=$(curl_get_body http://127.0.0.1:3003/foo/a1.txt)
27+
assert "$a" 'vhost2/a/a1.txt'
28+
29+
status=$(curl_get_status http://127.0.0.1:3003/foo/bar)
30+
assert "$status" '404'
31+
32+
baz=$(curl_get_body http://127.0.0.1:3003/foo/bar/baz/b1.txt)
33+
assert "$baz" 'vhost2/b/b1.txt'
34+
2635
jobs -p | xargs kill

test/case/006.bind.bash

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
source "$root"/lib.bash
4+
5+
"$ghfs" -l 3003 -r "$fs"/vhost1 -b :/foo:"$fs"/vhost2/a -b :/foo/bar/baz:"$fs"/vhost2/b -E '' &
6+
sleep 0.05 # wait server ready
7+
8+
a=$(curl_get_body http://127.0.0.1:3003/foo/a1.txt)
9+
assert "$a" 'vhost2/a/a1.txt'
10+
11+
a=$(curl_get_body http://127.0.0.1:3003/Foo/a1.txt)
12+
assert "$a" 'vhost2/a/a1.txt'
13+
14+
status=$(curl_get_status http://127.0.0.1:3003/foo/bar)
15+
assert "$status" '404'
16+
17+
status=$(curl_get_status http://127.0.0.1:3003/Foo/Bar)
18+
assert "$status" '404'
19+
20+
baz=$(curl_get_body http://127.0.0.1:3003/foo/bar/baz/b1.txt)
21+
assert "$baz" 'vhost2/b/b1.txt'
22+
23+
baz=$(curl_get_body http://127.0.0.1:3003/foo/bar/Baz/b1.txt)
24+
assert "$baz" 'vhost2/b/b1.txt'
25+
26+
jobs -p | xargs kill
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)