1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you maynot use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ##############################################################################
24 Library OperatingSystem
28 ${SSH_KEYFILE} /root/.ssh/id_rsa
31 Open Connection And Log In
32 Open Connection ${HOST}
33 Login With Public Key ${USERNAME} ${SSH_KEYFILE}
36 ${result}= Execute Command kubectl get nodes -l node-role.kubernetes.io/master -o jsonpath\='{.items[*].metadata.name}'
37 @{nodes}= Split String ${result}
38 Set Test Variable ${pod} etcd-@{nodes}[0]
39 ${members}= Get Etcd Members
40 Set Test Variable ${members}
43 ${result}= Execute Command kubectl exec -n kube-system -it ${pod} etcdctl${ETCD_VERSION} member list
47 ${result}= Execute Command kubectl delete pod -n kube-system ${pod}
48 Should Be Equal As Strings ${result} pod "${pod}" deleted msg="pod delete failed"
50 Wait For Etcd Node To Recover
51 Wait Until Keyword Succeeds 5m 10s Etcd Node Should Be Running
53 Etcd Node Should Be Running
54 ${result}= Execute Command kubectl get -n kube-system -o template pod/${pod} --template\='{{.status.phase}}'
55 Should Contain ${result} Running
57 Etcd Endpoint Should Be Healthy
58 ${result}= Execute Command kubectl exec -n kube-system -ti ${pod} etcdctl${ETCD_VERSION} endpoint health
59 Should Contain ${result} healthy
61 Etcd Members Should Be Unchanged
62 ${output}= Get Etcd Members
63 Should Be Equal As Strings ${output} ${members}
65 Etcd Cluster Should Be Healthy
66 Etcd Node Should Be Running
67 Etcd Endpoint Should Be Healthy
68 Etcd Members Should Be Unchanged