-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·61 lines (45 loc) · 1.23 KB
/
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
#!/bin/bash
source "./test_mapping.sh"
source "./test_sha.sh"
source "./test_delete.sh"
source "./test_events.sh"
source "./test_initial_find.sh"
PROJECT_NAME="copy_on_write_tests"
cleanup() {
docker compose -p $PROJECT_NAME down -t 1
cd "$baseDir"
rm -rf volumes/src/*
rm -rf volumes/target/*
}
# so that the script can be called from any directory
originalWd=$(pwd)
cd "$(dirname $0)"
baseDir=$(pwd)
trap 'cd $originalWd' EXIT
# cleanup before tests (in case previous test run has not finished)
cleanup
beforeStartMapping
beforeStartSHA
beforeStartDelete
beforeStartInitialFind
# wait one seconds to ensure a startuptime distinct to content created before startup
sleep 1
containerStartedTS=$(date +%s)
docker compose -p $PROJECT_NAME up --build -d --wait
sleep 1 # so the container has time do initial copying and initialize the watches
# shared by all tests. set to false to make test fail
success="true"
afterStartMapping
afterStartSHA
afterStartDelete
afterStartEvents
afterStartInitialFind
sleep 1
afterSleepEvents
cleanup
if [ $success = "false" ]; then
echo "Tests failed"
echo "Note that tests related to modification-time are flaky. Run again in case tests for timestamps fail"
else
echo "Successfully ran tests"
fi