-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·64 lines (55 loc) · 1.02 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
62
63
64
#!/usr/bin/env bash
cd "$(realpath "$(dirname "$0")")" &&
source bindle/project.sh
if [ $? -ne 0 ]; then
exit 1
fi
export CIRCLECI=''
assert-not-failed(){
if [ $? != 0 ];then
echo 'Test failed'
exit 1
fi
}
assert-failed(){
if [ $? == 0 ];then
echo 'Test did not fail'
exit 1
fi
}
test_should_abort(){
export BASE_API_URL='test'
export CIRCLE_BUILD_NUM='9305'
./cancel-redundant-builds.sh
assert-failed
}
test_should_pass(){
export BASE_API_URL='test'
export CIRCLE_BUILD_NUM='9311'
./cancel-redundant-builds.sh
assert-not-failed
}
test_should_skip(){
export BASE_API_URL='test'
export CIRCLE_BUILD_NUM='9312'
./cancel-redundant-builds.sh
assert-not-failed
}
test_empty(){
export BASE_API_URL='empty'
./cancel-redundant-builds.sh
assert-not-failed
}
test_not_found(){
export BASE_API_URL='test'
export CIRCLE_BUILD_NUM='9313'
./cancel-redundant-builds.sh
assert-not-failed
}
-lint &&
echo-message 'Running tests' &&
test_should_abort &&
test_should_pass &&
test_should_skip &&
test_empty &&
test_not_found