-
Notifications
You must be signed in to change notification settings - Fork 46
/
integration_test.sh
executable file
·88 lines (70 loc) · 1.49 KB
/
integration_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
# !/bin/bash
#
# ./integration_test.sh
#
# This is a prototype end-to-end test for microplane.
#
# Please read carefully and use at your own risk.
set -e
####################
# Script setup
####################
provider=$1
nuke=$2
usage() {
echo "usage: ./integration_test.sh <github|gitlab> {nuke}"
}
# specify provider
if [ "$provider" != "github" ] && [ "$provider" != "gitlab" ]; then
usage
exit 1
fi
owner="microplane-test"
if [ "$provider" == "gitlab" ]; then
owner="microplane-gitlab"
fi
# nuke is optional
if [ "$nuke" == "nuke" ]; then
echo "nuking ./mp"
rm -rf ./mp
fi
if [ -d "mp" ]; then
echo "Working directory ./mp already exists. Please remove before running."
exit 1
fi
####################
# Run microplane e2e
####################
echo "[Init]"
tmpfile=$(mktemp /tmp/mp-integration-test.XXXXXX)
echo "$owner/1" >> $tmpfile
echo "$owner/2" >> $tmpfile
./bin/mp init --provider $provider -f $tmpfile
rm $tmpfile
echo ""
echo "[Clone]"
./bin/mp clone
ts=`date +"%T"`
./bin/mp status
./bin/mp sync
echo ""
echo "[Plan]"
./bin/mp plan -b plan -m "plan" -- sh -c "echo $ts >> README.md"
./bin/mp status
./bin/mp sync
echo ""
echo "[Push]"
./bin/mp push --throttle 2s -a nathanleiby
./bin/mp status
./bin/mp sync
echo ""
echo "[Merge]"
cmd='./bin/mp merge --throttle 2s --ignore-build-status --ignore-review-approval'
duration=10
until $cmd; do
echo "waiting a bit ($duration seconds) so PRs are mergeable..."
sleep $duration
done
echo ""
./bin/mp status
./bin/mp sync