add clustercheck script (avoid splitbrain)
diff --git a/tests/integration/master_cluster/checks_clustercheck_spec.rb b/tests/integration/master_cluster/checks_clustercheck_spec.rb
new file mode 100644
index 0000000..d10fc19
--- /dev/null
+++ b/tests/integration/master_cluster/checks_clustercheck_spec.rb
@@ -0,0 +1,10 @@
+describe file('/etc/xinetd.d/mysql_clustercheck') do
+ it('should exist')
+ its('content') { should match /server.*\/usr\/local\/bin\/mysql_clustercheck/ }
+ its('content') { should match /server_args.*clustercheck password available_when_donor=1 \/dev\/null available_when_readonly=1/ }
+end
+
+describe file('/usr/local/bin/mysql_clustercheck') do
+ it('should exist')
+ it('should be_executable')
+end
diff --git a/tests/integration/slave_cluster/checks_clustercheck_spec.rb b/tests/integration/slave_cluster/checks_clustercheck_spec.rb
new file mode 100644
index 0000000..d10fc19
--- /dev/null
+++ b/tests/integration/slave_cluster/checks_clustercheck_spec.rb
@@ -0,0 +1,10 @@
+describe file('/etc/xinetd.d/mysql_clustercheck') do
+ it('should exist')
+ its('content') { should match /server.*\/usr\/local\/bin\/mysql_clustercheck/ }
+ its('content') { should match /server_args.*clustercheck password available_when_donor=1 \/dev\/null available_when_readonly=1/ }
+end
+
+describe file('/usr/local/bin/mysql_clustercheck') do
+ it('should exist')
+ it('should be_executable')
+end
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index a12e7d7..bd27fa2 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -7,7 +7,7 @@
port: 3306
maintenance_password: password
admin:
- user: user
+ user: root
password: password
members:
- host: 127.0.0.1
@@ -16,6 +16,13 @@
port: 4567
- host: 127.0.0.1
port: 4567
+ clustercheck:
+ enabled: True
+ user: clustercheck
+ password: password
+ available_when_donor: 1
+ available_when_readonly: 1
+ port: 9200
mysql:
server:
users:
@@ -27,17 +34,15 @@
host: 127.0.0.1
- name: clustercheck
#host: localhost
- password: clustercheck
+ password: password
database: '*.*'
grants: PROCESS
- grant_option: False
- name: inspector
host: 127.0.0.1
password: password
databases:
- mydb:
- - database: mydb
- - table: mytable
- - grant_option: False
- - grants:
- - all privileges
+ - database: mydb
+ table: mytable
+ grant_option: True
+ grants:
+ - all privileges
diff --git a/tests/pillar/slave_cluster.sls b/tests/pillar/slave_cluster.sls
index 10dfccb..73bf999 100644
--- a/tests/pillar/slave_cluster.sls
+++ b/tests/pillar/slave_cluster.sls
@@ -7,7 +7,7 @@
port: 3306
maintenance_password: password
admin:
- user: user
+ user: root
password: password
members:
- host: 127.0.0.1
@@ -16,6 +16,13 @@
port: 4567
- host: 127.0.0.1
port: 4567
+ clustercheck:
+ enabled: True
+ user: clustercheck
+ password: password
+ available_when_donor: 1
+ available_when_readonly: 1
+ port: 9200
mysql:
server:
users:
@@ -24,4 +31,9 @@
- name: haproxy
host: '%'
- name: haproxy
- host: 127.0.0.1
\ No newline at end of file
+ host: 127.0.0.1
+ - name: clustercheck
+ #host: localhost
+ password: password
+ database: '*.*'
+ grants: PROCESS
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 3f42101..fe0d87e 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -126,6 +126,7 @@
run() {
for pillar in ${PILLARDIR}/*.sls; do
state_name=$(basename ${pillar%.sls})
+ salt_run grains.set 'noservices' False force=True
salt_run --id=${state_name} state.show_sls ${FORMULA_NAME} || (log_err "Execution of ${FORMULA_NAME}.${state_name} failed"; exit 1)
done
}