Skip to content

Commit

Permalink
test: add case for delete and mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
marjune163 committed Apr 9, 2020
1 parent 9684c46 commit d00a496
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/case/013.alias.delete.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

cleanup() {
rm -f "$fs"/uploaded/[12]/*.tmp
}

source "$root"/lib.bash

"$ghfs" -l 3003 -r "$fs"/vhost1 -a :/free/space:"$fs"/uploaded/1 -a :/share/dir:"$fs"/uploaded/2 --delete /free/space --delete-dir "$fs"/uploaded/2 &
sleep 0.05 # wait server ready
cleanup

file1="$fs"/uploaded/1/1.tmp
echo -n 'uploaded/1/1.tmp' > "$file1"
ls "$file1" &> /dev/null || fail "$file1 not exists"
curl_head_status 'http://127.0.0.1:3003/free/space?delete&name=1.tmp' > /dev/null
ls "$file1" &> /dev/null && fail "$file1 exists"

file2="$fs"/uploaded/2/2.tmp
echo -n 'uploaded/2/2.tmp' > "$file2"
ls "$file2" &> /dev/null || fail "$file2 not exists"
curl_head_status 'http://127.0.0.1:3003/share/dir?delete&name=2.tmp' > /dev/null
ls "$file2" &> /dev/null && fail "$file2 exists"

cleanup
kill %1
26 changes: 26 additions & 0 deletions test/case/014.alias.shadowed.delete.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

cleanup() {
rm -f "$fs"/uploaded/[12]/*.tmp
}

source "$root"/lib.bash

"$ghfs" -l 3003 -r "$fs"/uploaded/1 -a :/x.tmp:"$fs"/uploaded/2 -a:/y.tmp/z.tmp:"$fs"/uploaded/2 --delete / &
sleep 0.05 # wait server ready
cleanup

file1="$fs"/uploaded/1/x.tmp
echo -n 'uploaded/1/1.tmp' > "$file1"
ls "$file1" &> /dev/null || fail "$file1 not exists"
curl_head_status 'http://127.0.0.1:3003/?delete&name=x.tmp' > /dev/null
ls "$file1" &> /dev/null || fail "$file1 not exists"

file2="$fs"/uploaded/1/y.tmp
echo -n 'uploaded/1/1.tmp' > "$file2"
ls "$file2" &> /dev/null || fail "$file2 not exists"
curl_head_status 'http://127.0.0.1:3003/?delete&name=x.tmp' > /dev/null
ls "$file2" &> /dev/null || fail "$file2 not exists"

cleanup
kill %1
19 changes: 19 additions & 0 deletions test/case/015.mkdir.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

cleanup() {
rm -rf "$fs"/uploaded/[12]/*.tmp
}

source "$root"/lib.bash

"$ghfs" -l 3003 -r "$fs"/uploaded/ --mkdir /1 &
sleep 0.05 # wait server ready
cleanup

file="$fs"/uploaded/1/foo.tmp
ls -d "$file1" &> /dev/null && fail "$file1 exists"
curl_head_status 'http://127.0.0.1:3003/1/?mkdir&name=foo.tmp' > /dev/null
ls -d "$file1"/ &> /dev/null || fail "$file1 not exists"

cleanup
kill %1
File renamed without changes.
24 changes: 24 additions & 0 deletions test/case/017.alias.shadowed.mkdir.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

cleanup() {
rm -f "$fs"/uploaded/[12]/*.tmp
}

source "$root"/lib.bash

"$ghfs" -l 3003 -r "$fs"/uploaded/1 -a :/x.tmp:"$fs"/uploaded/2 -a:/y.tmp/z.tmp:"$fs"/uploaded/2 --delete / &
sleep 0.05 # wait server ready
cleanup

file1="$fs"/uploaded/1/x.tmp
ls "$file1" &> /dev/null && fail "$file1 exists"
curl_head_status 'http://127.0.0.1:3003/?mkdir&name=x.tmp' > /dev/null
ls "$file1" &> /dev/null && fail "$file1 exists"

file2="$fs"/uploaded/1/y.tmp
ls "$file2" &> /dev/null && fail "$file2 exists"
curl_head_status 'http://127.0.0.1:3003/?mkdir&name=x.tmp' > /dev/null
ls "$file2" &> /dev/null && fail "$file2 exists"

cleanup
kill %1
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d00a496

Please sign in to comment.