-
Notifications
You must be signed in to change notification settings - Fork 0
/
blackbox_test.sh
executable file
·71 lines (65 loc) · 1.76 KB
/
blackbox_test.sh
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
64
65
66
67
68
69
70
71
compare() {
if [ -z "$(diff -arq ~/test1 ~/test2)" ]; then
echo "Files in both instances match"
else
echo "ERROR: Diff was found: $(diff -arq ~/test1 ~/test2)"
exit 1
fi
}
blackBox() {
discovery-server 2> /dev/null &
sleep 5s #Wait for discovery server to start
echo "Starting up Paranoid system"
paranoid-cli init test1 -u -p testPool 2> /dev/null
paranoid-cli init test2 -u -p testPool 2> /dev/null
mkdir ~/test1
mkdir ~/test2
yes | paranoid-cli mount test1 ~/test1 -d 127.0.0.1:10101 2> /dev/null
echo "Waiting for PFSD 1 mount"
sleep 5s #waiting for both to come to life
yes | paranoid-cli mount test2 ~/test2 -d 127.0.0.1:10101 2> /dev/null
echo "Waiting for PFSD 2 mount"
sleep 15s #waiting for both to come to life. It seems to take some time before paranoid-cli is ready to start
echo "CP Test"
cp /bin/cp ~/test1/
cp /bin/mv ~/test2/
sleep 10s #Making sure PFSD has enough time to transfer
compare
if [ -z "$(cmp ~/test1/cp ~/test2/cp)" ]; then
echo "Files Match"
else
echo "ERROR: Files Didnt Match"
exit 1
fi
}
torture() {
echo "Torture"
cp -Rf /bin/ ~/test1/
sleep 10s #Making sure PFSD has enough time to transfer
echo "Testing Large Random Files"
head -c 50M /dev/urandom > ~/test1/newRand.txt #This is going to take a while
head -c 250M /dev/urandom > ~/test2/random.txt
sleep 5s
compare
if [ -z "$(cmp ~/test1/random.txt ~/test2/random.txt)" ]; then
echo "Files Match"
else
echo "ERROR: Files Didnt Match"
exit 1
fi
}
cleanup() {
echo "Cleaning Up Tests"
paranoid-cli unmount test1
sleep 5s
paranoid-cli unmount test2
sleep 5s
paranoid-cli delete test1
paranoid-cli delete test2
pkill discovery-server
rm -rf ~/test2 ~/test1
}
blackBox
torture
sleep 5s
cleanup