aboutsummaryrefslogtreecommitdiffstats
path: root/test/restore.sh
blob: 2d60cb98a059645192b801f3b4fe294797b8fb3e (plain) (blame)
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
#!/bin/bash

init restore

# setup test configs
path1=$BIN/test1.conf
path2=$BIN/test2.conf
path3=$BIN/test3.conf
path4=$BIN/test4.conf

add_config prog1 $path1
add_config prog1 $path2

add_config prog2 $path3
add_config prog2 $path4

# delete prog1 links
rm "$path1" "$path2"

# restore them
exec $BIN/ck -c $BIN restore -p prog1 >&${V} &
wait $!

for i in $($BIN/ck -c $BIN list -p prog1); do
    if [[ ! -L "$i" ]]; then
       err "Couldn't restore path $i"
       exit 1
    fi
done

## delete all links
rm "$path1" "$path2" "$path3" "$path4"

# restore all
exec $BIN/ck -c $BIN restore all >&${V} &
wait $!

for i in $($BIN/ck -c $BIN list paths); do
    if [[ ! -L "$i" ]]; then
       err "Couldn't restore path $i"
       exit 1
    fi
done

clear_tests
echo -e $PASS