summaryrefslogtreecommitdiffstats
path: root/tools/ocft/mysql-proxy
blob: e16d52b327658dc353e69f6af4d8349b9fb8c00c (plain)
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
# mysql-proxy
# by r.bhatia@ipax.at
#
# test cases (to implement):
#
# * /usr/sbin/ocf-tester -n mp -o binary="/usr/sbin/mysql-proxy" -o defaults_file="" -o parameters="--proxy-skip-profiling" \
#       -o admin_address="127.0.0.1:4041" -o admin_username="root" -o admin_password="la" -o admin_lua_script="/usr/lib/mysql-proxy/lua/admin.lua" \
#       -o proxy_backend_addresses="192.168.100.200:42006" -o proxy_address="/var/run/mysqld/mysqld.sock" /usr/lib/ocf/resource.d/heartbeat/mysql-proxy
#
# * OCF_CHECK_LEVEL 20 check

CONFIG
	Agent mysql-proxy
	AgentRoot /usr/lib/ocf/resource.d/heartbeat/
	InstallPackage mysql-proxy
	HangTimeout 20

SETUP-AGENT
	# nothing

CASE-BLOCK crm_setting
	Env OCF_RESKEY_CRM_meta_timeout=15000
	Env OCF_RESKEY_binary=/tmp/mysql-proxy
	Env OCF_RESKEY_admin_username=root
	Env OCF_RESKEY_admin_password=test123
	Env OCF_RESKEY_admin_lua_script=/usr/lib/mysql-proxy/lua/admin.lua

CASE-BLOCK default_status
	AgentRun stop

CASE-BLOCK prepare
	Bash [ ! -x /tmp/mysql-proxy ] && ln -s `which mysql-proxy` /tmp/mysql-proxy || true
	Include crm_setting

CASE-BLOCK teardown
	AgentRun stop
	BashAtExit rm -f /tmp/mysql-proxy

CASE "check base env"
	Include prepare
	AgentRun start OCF_SUCCESS
	Include teardown

CASE "check base env: invalid 'OCF_RESKEY_binary'"
	Include prepare
	Env OCF_RESKEY_binary=no_such
	AgentRun start OCF_ERR_INSTALLED
	BashAtExit rm -f /tmp/mysql-proxy

CASE "normal start"
	Include prepare
	AgentRun start OCF_SUCCESS
	Include teardown

CASE "normal stop"
	Include prepare
	AgentRun start
	AgentRun stop OCF_SUCCESS
	Include teardown

CASE "double start"
	Include prepare
	AgentRun start
	AgentRun start OCF_SUCCESS
	Include teardown

CASE "double stop"
	Include prepare
	AgentRun stop OCF_SUCCESS

CASE "running monitor"
	Include prepare
	AgentRun start
	AgentRun monitor OCF_SUCCESS
	Include teardown

CASE "not running monitor"
	Include prepare
	AgentRun monitor OCF_NOT_RUNNING

CASE "unimplemented command"
	Include prepare
	AgentRun no_cmd OCF_ERR_UNIMPLEMENTED