-
Notifications
You must be signed in to change notification settings - Fork 4
/
test-allas-tools
executable file
·63 lines (50 loc) · 1.07 KB
/
test-allas-tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
mkdir test_$$
echo "aaa" > test_$$/a.txt
echo "bbb" > test_$$/b.txt
echo "ccc" > test_$$/c.txt
test_bucket="allastest$$"
#a-put
object=$(a-put -b $test_bucket test_$$ -s 2> /dev/null | tail -1 | tr -d "\n")
if [[ $object == "$test_bucket/test_$$.tar" ]] ; then
echo "a-put OK"
else
echo "a-put FAILED"
echo $object
# exit 1
fi
#a-list
t1=$(a-list $test_bucket | tr -d "\n" )
if [[ $t1 == "$test_bucket/test_$$.tar" ]]; then
echo "a-list OK"
else
echo "a-list FAILED"
echo "a-list $test_bucket"
a-list $test_bucket
exit
fi
#a-info
if [[ $(a-info $object | grep -c "test_") -eq 8 ]]; then
echo "a-info OK"
else
echo "a-info FAILED"
echo "a-info $object"
exit
fi
rm -rf test_$$
#a-get
a-get $object > /dev/null
if [[ $(ls test_$$ | grep -c .txt) -eq 3 ]]; then
echo "a-get OK"
else
echo "a-get FAILED"
fi
a-delete -f $object > /dev/null
a-delete --rmb $test_bucket -f > /dev/null
rm -rf test_$$
a=$(a-list $test_bucket 2>&1 | awk '{print $(NF-1)" "$NF}' )
if [[ $a == "not found" ]]; then
echo "a-delete OK"
else
echo "a-delete FAILED"
fi