-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathe2e-test.sh
executable file
·96 lines (66 loc) · 1.75 KB
/
e2e-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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
# Run e2e tests on cultura
echo "Start the daemon"
cargo run -- daemon start
cultura_process_count=$(pgrep -c -f cultura)
if [ "$cultura_process_count" -eq 1 ]; then
echo "The daemon is started"
else
echo "The daemon is not properly started"
exit 1
fi
cargo run daemon start
cultura_process_count=$(pgrep -c -f cultura)
if [ "$cultura_process_count" -eq 1 ]; then
echo "The daemon is started only once"
else
echo "The daemon is not started only once"
exit 1
fi
echo "Check the config folder exists"
stat ~/.config/cultura/
echo
echo "Check the database exists"
stat ~/.config/cultura/cultura.db
echo
echo "Check the config file exists"
stat ~/.config/cultura/config.toml
echo
echo "Dump config"
cat ~/.config/cultura/config.toml
sleep 10
echo "Check the database size"
stat ~/.config/cultura/cultura.db
echo
cargo run fact generate-random >generate-random.out
echo "Dump the content of the generation command"
cat generate-random.out
echo
echo "Check if the generation command works"
grep -E "Did you know that|Today I learned" generate-random.out
echo
echo "Kill the daemon"
cargo run daemon stop
if [[ $(pgrep -c -f cultura || true) -ne 0 ]]; then
echo "The daemon stop command failed"
exit 1
fi
echo "Start again the daemon"
cargo run -- daemon start
cultura_process_count=$(pgrep -c -f cultura)
if [ "$cultura_process_count" -eq 1 ]; then
echo "The daemon is started"
else
echo "The daemon is not properly started"
exit 1
fi
echo "Run the doctor reset command"
cargo run -- doctor reset
if [[ $(pgrep -c -f cultura || true) -ne 0 ]]; then
echo "The daemon stop command failed"
exit 1
fi
if [[ -d ~/.config/cultura ]]; then
echo "The config folder is not removed"
exit 1
fi