forked from Puppet-Finland/puppet-puppetmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_vagrant_tests.sh
executable file
·66 lines (47 loc) · 2.22 KB
/
run_vagrant_tests.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
#!/bin/sh
#
# run_vagrant_tests.sh
#
# Run all installer scenario variants to detect regressions early
#
usage() {
echo "Usage: run_vagrant_tests.sh"
}
if ! [ -r "./run_vagrant_tests.sh" ]; then
echo "ERROR: this script must be run from <installer-basedir>/vagrant"
exit 1
fi
# Run an individual Vagrant test
run_test() {
VM=$1
SCENARIO=$2
ANSWER_FILE_NAME="$3"
TARGET_ANSWER_FILE_NAME="$(echo $ANSWER_FILE_NAME|cut -d "_" -f 1)"
TARGET_ANSWER_FILE_PATH="../config/installer-scenarios.d/${TARGET_ANSWER_FILE_NAME}"
LOGFILE="test/logs/${VM}-${SCENARIO}-${ANSWER_FILE_NAME}-${TIMESTAMP}-${COMMIT}.log"
echo >> $LOGFILE 2>&1
echo "TEST CASE: VM=$VM SCENARIO=$SCENARIO ANSWER_FILE_NAME=$ANSWER_FILE_NAME" >> $LOGFILE 2>&1
echo >> $LOGFILE 2>&1
cp "test/$ANSWER_FILE_NAME" $TARGET_ANSWER_FILE_PATH
RUN_INSTALLER=true SCENARIO=$SCENARIO vagrant up $VM >> $LOGFILE 2>&1
vagrant destroy -f $VM >> $LOGFILE 2>&1
git checkout -- $TARGET_ANSWER_FILE_PATH
}
# Prepare for the tests
mkdir -p test/logs
TIMESTAMP=$(date +'%s')
COMMIT=$(git rev-parse --short HEAD)
# Puppetsever with GitLab r10k configuration
run_test puppetserver-bionic puppetserver puppetserver-answers.yaml_gitlab
# Puppetserver with default settings
run_test puppetserver-bionic puppetserver puppetserver-answers.yaml_default
run_test puppetserver-stretch puppetserver puppetserver-answers.yaml_default
run_test puppetserver-centos7 puppetserver puppetserver-answers.yaml_default
# Puppetserver + PuppetDB with default settings
run_test puppetserver-bionic puppetserver-with-puppetdb puppetserver-with-puppetdb-answers.yaml_default
run_test puppetserver-stretch puppetserver-with-puppetdb puppetserver-with-puppetdb-answers.yaml_default
run_test puppetserver-centos7 puppetserver-with-puppetdb puppetserver-with-puppetdb-answers.yaml_default
# Puppetserver + PuppetDB + Puppetboard with default settings
run_test puppetserver-bionic puppetserver-with-puppetboard puppetserver-with-puppetboard-answers.yaml_default
run_test puppetserver-stretch puppetserver-with-puppetboard puppetserver-with-puppetboard-answers.yaml_default
run_test puppetserver-centos7 puppetserver-with-puppetboard puppetserver-with-puppetboard-answers.yaml_default