3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 Library cluster.cluster.Cluster WITH NAME Cluster
18 Library crl.remotesession.remotesession.RemoteSession
19 ... WITH NAME RemoteSession
21 Test Setup ssh.Setup Connections
27 :FOR ${node} IN @{ALL_MASTERS_IN_SYSTEM}
28 \ ${output}= Ssh.Execute Command hostname ${node}
29 \ Should Be Equal ${node} ${output}
31 :FOR ${node} IN @{ALL_PURE_WORKERS_IN_SYSTEM}
32 \ ${output}= Ssh.Execute Command hostname ${node}
33 \ Should Be Equal ${node} ${output}
35 :FOR ${node} IN @{ALL_PURE_STORAGES_IN_SYSTEM}
36 \ ${output}= Ssh.Execute Command hostname ${node}
37 \ Should Be Equal ${node} ${output}
39 ${hosts}= Cluster.Get Hosts
40 :FOR ${node} IN @{hosts}
41 \ ${output}= Ssh.Execute Command hostname ${node.name}
42 \ Should Be Equal ${node.name} ${output}
44 ${masters_len}= Get Length ${ALL_MASTERS_IN_SYSTEM}
46 Should Be True ${masters_len} == 3
47 ... Number of masters should be 3 not ${masters_len}
50 Reboot Management VIP Node
51 RemoteSession.Execute Background Command In Target sleep 1; reboot
52 ... target=sudo-default
59 ${result}= RemoteSession.Execute Command In Target
60 ... systemctl stop mariadb.service ${node}
61 Should Be Equal ${result.status} 0 ${result.stderr}
65 ${result}= RemoteSession.Execute Command In Target
66 ... systemctl start mariadb.service ${node}
67 Should Be Equal ${result.status} 0 ${result.stderr}
70 [Arguments] ${node}=sudo-default ${expected_cluster_size}=3
71 ${out}= ssh.Execute Command mysql <<< "show status like 'wsrep_cluster_size';"
73 Should match ${out} *wsrep_cluster_size*${expected_cluster_size}*
77 Verify Cluster Config Management
80 Verify Cluster Config Management After Reboot Management VIP Node
81 Reboot Management VIP Node
82 Wait Until Keyword Succeeds 600s 1s Validate Cluster
84 Verify Database Stop And Start
85 ${first_master}= Collections.Get From List ${ALL_MASTERS_IN_SYSTEM} 0
86 Stop Database sudo-${first_master}
87 Wait Until Keyword Succeeds 6x 18s Verify Database sudo-${first_master}
88 ... expected_cluster_size=2
89 Start Database sudo-${first_master}
90 Wait Until Keyword Succeeds 6x 18s Verify Database sudo-${first_master}
92 Verify Create All And No Roles
93 [Documentation] Verify no_roles and all_roles user creation
94 ${all_roles}= Cluster.Create User With Roles all_roles
96 ${no_roles}= Cluster.Create User With Roles no_roles
100 [Documentation] Test SudoShells
101 ${hosts}= Cluster.Get Hosts
102 :FOR ${node} IN @{hosts}
103 \ ${result}= RemoteSession.Execute Command In Target whoami
104 \ ... target=sudo-${node.name}
105 \ Should Be Equal ${result.stdout} root
107 ${result}= RemoteSession.Execute Command In Target whoami
108 ... target=sudo-default
109 Should Be Equal ${result.stdout} root
111 Verify Remotescript Default
112 [Documentation] test target remotescript-default
113 ${result}= RemoteSession.Execute Command In Target echo -n out
114 ... target=remotescript-default
115 Should Be Equal ${result.stdout} out