2 Documentation Suite mixing basic operations with isolation of car Leader.
4 ... Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
11 ... This test isolates the current leader of the "car" shard and then executes CRD
12 ... operations on the new leader and a new follower. The isolated member is brought back.
13 ... This suite uses 3 different car sets, same size but different starting ID.
15 ... Other models and shards (people, car-people) are not accessed by this suite.
17 ... All data is deleted at the end of the suite.
18 ... This suite expects car module to have a separate Shard.
20 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
21 Default Tags clustering carpeople critical
23 Resource ${CURDIR}/../../../libraries/CarPeople.robot
24 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
25 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
26 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
27 Variables ${CURDIR}/../../../variables/Variables.py
31 ${FOLLOWER_2NODE_START_I} 300
32 ${LEADER_2NODE_START_I} 200
33 ${MEMBER_START_TIMEOUT} 300s
34 ${ORIGINAL_START_I} 100
37 @{SHARD_NAME_LIST} ${SHARD_NAME}
38 ${VAR_DIR} ${CURDIR}/../../../variables/carpeople/crud
41 Add_Original_Cars_On_Old_Leader_And_Verify
42 [Documentation] Add initial cars on car Leader.
43 TemplatedRequests.Put_As_Json_Templated folder=${VAR_DIR}/cars session=${car_leader_session} iterations=${CAR_ITEMS} iter_start=${ORIGINAL_START_I}
44 : FOR ${session} IN @{ClusterManagement__session_list}
45 \ BuiltIn.Wait_Until_Keyword_Succeeds 10s 2s TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${session}
46 \ ... verify=True iterations=${CAR_ITEMS} iter_start=${ORIGINAL_START_I}
48 Isolate_Original_Car_Leader
49 [Documentation] Isolate the car Leader to cause a new leader to get elected.
50 ClusterManagement.Isolate_Member_From_List_Or_All ${car_leader_index}
53 [Documentation] Wait until new car Leader is elected.
54 BuiltIn.Wait_Until_Keyword_Succeeds 30s 2s ClusterManagement.Verify_Shard_Leader_Elected ${SHARD_NAME} ${SHARD_TYPE} ${True}
55 ... ${car_leader_index} member_index_list=${car_follower_indices}
56 CarPeople.Set_Tmp_Variables_For_Shard_For_Nodes member_index_list=${car_follower_indices} shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE}
58 See_Original_Cars_On_New_Leader
59 [Documentation] GET cars from new Leader, should be the initial ones.
60 TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${new_leader_session} verify=True iterations=${CAR_ITEMS} iter_start=${ORIGINAL_START_I}
62 See_Original_Cars_On_New_Followers
63 [Documentation] The same check on other existing member(s).
64 : FOR ${session} IN @{new_follower_sessions}
65 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${session} verify=True iterations=${CAR_ITEMS} iter_start=${ORIGINAL_START_I}
67 Delete_Original_Cars_On_New_Leader
68 [Documentation] Delete cars on the new Leader.
69 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/cars session=${new_leader_session}
71 Add_Leader_Cars_On_New_Leader
72 [Documentation] Add cars on the new Leader.
73 TemplatedRequests.Put_As_Json_Templated folder=${VAR_DIR}/cars session=${new_leader_session} iterations=${CAR_ITEMS} iter_start=${LEADER_2NODE_START_I}
75 See_Leader_Cars_On_New_Leader
76 [Documentation] GET cars from new Leader, should be the new ones.
77 TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${new_leader_session} verify=True iterations=${CAR_ITEMS} iter_start=${LEADER_2NODE_START_I}
79 See_Leader_Cars_On_New_Followers
80 [Documentation] The same check on other existing members.
81 : FOR ${session} IN @{new_follower_sessions}
82 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${session} verify=True iterations=${CAR_ITEMS} iter_start=${LEADER_2NODE_START_I}
84 Delete_Leader_Cars_On_New_First_Follower
85 [Documentation] Delete cars in new first Follower.
86 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/cars session=${new_first_follower_session}
88 Add_Follower_Cars_On_New_First_Follower
89 [Documentation] Add cars on the new first Follower.
90 TemplatedRequests.Put_As_Json_Templated folder=${VAR_DIR}/cars session=${new_first_follower_session} iterations=${CAR_ITEMS} iter_start=${FOLLOWER_2NODE_START_I}
92 See_Folower_Cars_On_New_Leader
93 [Documentation] Get cars from the new Leader, should be the ones added on follower.
94 TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${new_leader_session} verify=True iterations=${CAR_ITEMS} iter_start=${FOLLOWER_2NODE_START_I}
96 See_Follower_Cars_On_New_Followers
97 [Documentation] The same check on other existing members.
98 : FOR ${session} IN @{new_follower_sessions}
99 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${session} verify=True iterations=${CAR_ITEMS} iter_start=${FOLLOWER_2NODE_START_I}
101 Rejoin_Old_Car_Leader
102 [Documentation] Rejoin the isolated member without deleting the persisted data.
103 ClusterManagement.Rejoin_Member_From_List_Or_All ${car_leader_index}
104 BuiltIn.Wait_Until_Keyword_Succeeds 30s 2s ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_NAME_LIST} shard_type=config
106 See_Folower_Cars_On_Old_Leader
107 [Documentation] GET cars from the restarted member, should be the ones added on follower.
108 TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${car_leader_session} verify=True iterations=${CAR_ITEMS} iter_start=${FOLLOWER_2NODE_START_I}
110 Delete_Follower_Cars_On_New_Leader
111 [Documentation] Delete cars on the last Leader.
112 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/cars session=${new_leader_session}
116 [Documentation] Initialize resources, memorize car shard leader and followers.
117 SetupUtils.Setup_Utils_For_Setup_And_Teardown
118 CarPeople.Set_Variables_For_Shard shard_name=car