forked from tom-krieger/cis_security_hardening
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acc_test.sh
executable file
·73 lines (61 loc) · 2.69 KB
/
acc_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
#!/bin/bash
VGIMAGES="vg-centos-7 vg-alma-8 vg-rocky-8"
VGIMAGES="vg-centos-7 vg-debian-11 vg-debian-12"
if [ $# -ne 1 ]
then
prog=`basename $0`
echo "usage: ${prog} [docker|vagrant]"
exit 1
fi
if [ "$1" != 'docker' -a "$1" != "vagrant" ]
then
prog=`basename $0`
echo "usage: ${prog} [docker|vagrant]"
exit 1
fi
pdk bundle -v
rm -f Gemfile.lock
pdk bundle install --quiet >/dev/null
case $1 in
'docker')
echo "=== running for $1"
pdk bundle exec rake "litmus:provision_list[docker]"
pdk bundle exec rake 'litmus:install_agent[puppet6]'
pdk bundle exec bolt command run 'puppet --version' -t all -i spec/fixtures/litmus_inventory.yaml
pdk bundle exec rake litmus:install_module
pdk bundle exec bolt command run 'puppet module list' -t all -i spec/fixtures/litmus_inventory.yaml
echo "=== applying module"
pdk bundle exec rake litmus:acceptance:parallel
pdk bundle exec rake 'litmus:tear_down'
;;
'vagrant')
echo "=== running for $1"
for vgi in $VGIMAGES ; do
echo "=== deploying image $vgi"
pdk bundle exec rake "litmus:provision_list[$vgi]"
pdk bundle exec rake 'litmus:install_agent[puppet6]'
pdk bundle exec bolt command run 'puppet --version' -t all -i spec/fixtures/litmus_inventory.yaml
pdk bundle exec rake litmus:install_module
pdk bundle exec bolt command run 'puppet module list' -t all -i spec/fixtures/litmus_inventory.yaml
if [ "$vgi" = "vg-centos-7" ]
then
pdk bundle exec bolt file upload spec/acceptance/data/vagrant/cis_CentOS_7_params.yaml /etc/puppetlabs/code/environments/production/modules/cis_security_hardening/data/cis/cis_CentOS_7_params.yaml -t all -i spec/fixtures/litmus_inventory.yaml
fi
echo "=== applying module"
pdk bundle exec rake litmus:acceptance:parallel
pdk bundle exec rake litmus:acceptance:parallel
pdk bundle exec rake litmus:acceptance:parallel
# run tests with more output
# TARGET_HOST=localhost:2222 pdk bundle exec rspec ./spec/acceptance --format d
# TARGET_HOST=localhost:2223 pdk bundle exec rspec ./spec/acceptance --format d
pdk bundle exec rake 'litmus:tear_down'
done
;;
*)
echo "no clue what to do: $1"
exit 2
;;
esac
# pdk bundle exec bolt file upload spec/acceptance/data/cis_centos_7_rules.yaml /etc/puppetlabs/code/environments/production/modules/cis_security_hardening/data/cis/cis_centos_7_rules.yaml -t all -i spec/fixtures/litmus_inventory.yaml
# pdk bundle exec bolt file upload spec/acceptance/data/cis_centos_7_params.yaml /etc/puppetlabs/code/environments/production/modules/cis_security_hardening/data/cis/cis_centos_7_params.yaml -t all -i spec/fixtures/litmus_inventory.yaml
exit 0