Skip to content

Commit 2250ac2

Browse files
committed
basic tests
1 parent aaf31d2 commit 2250ac2

File tree

5 files changed

+121
-9
lines changed

5 files changed

+121
-9
lines changed

.kitchen.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,65 @@ provisioner:
2424
use_instance_name : true
2525
groups :
2626
rabbitmq-cluster :
27-
- "cluster-1-docker-u14"
28-
- "cluster-2-docker-u14"
29-
- "cluster-3-docker-u14"
27+
- "cluster1.192.168.110.10.xip.io"
28+
- "cluster2.192.168.110.20.xip.io"
29+
# - "cluster-3-docker-u14"
3030
platforms:
3131
- name : docker-u14
3232
driver_config :
3333
image : quay.io/hellofresh/kitchen-base
3434
platform : ubuntu
3535
driver :
3636
name : docker
37+
socket : unix:///var/run/docker.sock
38+
use_sudo : false
3739

3840
suites :
3941
- name : standalone
4042
provisioner :
4143
playbook : "test/integration/standalone/standalone.yml"
4244
verifier :
4345
patterns : [ test/integration/standalone/serverspec/*_spec.rb ]
44-
driver_config :
45-
run_options : "-p 192.168.99.100:22:22"
4646

47-
- name : cluster_1
47+
- name : cluster1
4848
provisioner :
4949
playbook : "test/integration/cluster_1/cluster_1.yml"
50+
inventory_hostname: cluster1.192.168.110.10.xip.io
5051
verifier :
5152
patterns : [ test/integration/cluster_1/serverspec/*_spec.rb ]
5253
driver_config :
53-
run_options : --ip=172.17.0.11
54+
run_options : "--net cluster_network --ip=192.168.110.10"
55+
publish_all : true
56+
hostname : cluster1
57+
instance_name : cluster1
58+
# links :
59+
# - "cluster_2:cluster_2"
60+
# - "cluster_3:cluster_3"
61+
62+
- name : cluster2.192.168.110.20.xip.io
63+
provisioner :
64+
playbook : "test/integration/cluster_2/cluster_2.yml"
65+
inventory_hostname: cluster2.192.168.120.10.xip.io
66+
verifier :
67+
patterns : [ test/integration/cluster_2/serverspec/*_spec.rb ]
68+
driver_config :
69+
run_options : "--net cluster_network --ip=192.168.110.20"
70+
publish_all : true
71+
hostname : cluster2
72+
instance_name : cluster2
73+
# links :
74+
# - "cluster_1:cluster_1"
75+
# - "cluster_3:cluster_3"
76+
77+
- name : cluster3
78+
provisioner :
79+
playbook : "test/integration/cluster_3/cluster_3.yml"
80+
verifier :
81+
patterns : [ test/integration/cluster_3/serverspec/*_spec.rb ]
82+
driver_config :
83+
instance_name : cluster3
84+
publish_all : true
85+
# links :
86+
# - "cluster_1:cluster_1"
87+
# - "cluster_2:cluster_2"
88+

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
33
#gem 'net-ssh','~> 2.9'
44
# Could
55
gem 'kitchen-verifier-serverspec','~> 0.5.0'
6-
gem 'kitchen-ansiblepush'
6+
gem 'kitchen-ansiblepush', :git => 'https://github.com/ahelal/kitchen-ansiblepush', :ref => "feb8c904e600bab0361d1a287d3fa307a1da1bb1"
77
gem 'kitchen-docker'
88
gem 'serverspec'

test.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$1" == "run" ]; then
5+
echo ""
6+
echo "**** Running tests ****"
7+
echo "-> Docker creating userdefined network"
8+
docker network create --subnet 192.168.110.0/24 cluster_network
9+
10+
echo "-> Create cluster1"
11+
bundle exec kitchen create cluster1
12+
13+
echo "-> Create cluster2"
14+
bundle exec kitchen create cluster2
15+
16+
elif [ "$1" == "destroy" ]; then
17+
set +e
18+
echo ""
19+
echo "**** Running destroy ****"
20+
21+
echo "-> Destroy cluster1 "
22+
bundle exec kitchen destroy cluster1
23+
docker rm cluster1
24+
25+
echo "-> Destroy cluster2 "
26+
bundle exec kitchen destroy cluster2
27+
docker rm cluster2
28+
29+
echo "-> Docker remove userdefined network"
30+
docker network rm cluster_network
31+
else
32+
echo "unsupported option '$1'"
33+
echo "usage [ run | destroy ]"
34+
exit 1
35+
fi

test/integration/cluster_1/cluster_1.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- hosts: all
44
become: true
55
vars:
6+
rabbitmq_clustering_resolve_names : "no"
67
rabbitmq_ssl : false
78
#rabbitmq_plugins : ["rabbitmq_management","rabbitmq_tracing"]
89
rabbitmq_conf_tcp_listeners_address : "0.0.0.0"
Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
cluster_2.yml
1+
---
2+
3+
- hosts: all
4+
become: true
5+
vars:
6+
rabbitmq_ssl : false
7+
#rabbitmq_plugins : ["rabbitmq_management","rabbitmq_tracing"]
8+
rabbitmq_conf_tcp_listeners_address : "0.0.0.0"
9+
10+
rabbitmq_vhost_definitions :
11+
- name : "vhost_cluster1"
12+
- name : "ha.cluster"
13+
14+
rabbitmq_users_definitions :
15+
- vhost : "vhost_cluster1"
16+
user : cluster1
17+
password : "password"
18+
force : no
19+
20+
- vhost : "/"
21+
user : "admin"
22+
password : "password"
23+
force : no
24+
tags : ['administrator']
25+
rabbitmq_clustering : true
26+
rabbitmq_cluster_group : "rabbitmq-cluster"
27+
rabbitmq_cluster_post_fix_domain : ""
28+
rabbitmq_erlang_cookie : "MYCOOKIE"
29+
rabbitmq_cluster_debug : true
30+
31+
# HA Policy anythin prefixed with ha. will be mirrored on all nodes
32+
rabbitmq_policy_configuration :
33+
- name : "high availability policy"
34+
vhost : "/"
35+
pattern : "^ha\\."
36+
tags : '{"ha-mode":"all"}'
37+
38+
rabbitmq_cluster_api_user : "api-automation"
39+
rabbitmq_cluster_api_password : "password"
40+
41+
roles:
42+
- role: rabbitmq

0 commit comments

Comments
 (0)