2 Documentation This test focuses on testing buy-car RPC over the Leader isolation.
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 ... All purchases are against the same node, which is the first one to get isolated.
13 ... All data is deleted at the end of the suite.
14 ... This suite expects car, people and car-people modules to have separate Shards.
17 Resource ${CURDIR}/../../../libraries/CarPeople.robot
18 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
19 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
20 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
21 Variables ${CURDIR}/../../../variables/Variables.py
24 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
26 Default Tags clustering carpeople critical
30 ${CARPEOPLE_ITEMS} ${100}
31 ${MEMBER_START_TIMEOUT} 300s
32 @{SHARD_NAME_LIST} car people car-people
33 ${VAR_DIR} ${CURDIR}/../../../variables/carpeople/crud
37 Add_Cars_To_Leader_And_Verify
38 [Documentation] Add all needed cars to car Leader, verify on each member.
39 ${car_items} = BuiltIn.Evaluate ${CARPEOPLE_ITEMS} * 4
40 TemplatedRequests.Put_As_Json_Templated
41 ... folder=${VAR_DIR}/cars
42 ... session=${car_leader_session}
43 ... iterations=${car_items}
44 FOR ${session} IN @{ClusterManagement__session_list}
45 BuiltIn.Wait_Until_Keyword_Succeeds
48 ... TemplatedRequests.Get_As_Json_Templated
49 ... folder=${VAR_DIR}/cars
50 ... session=${session}
52 ... iterations=${car_items}
55 Add_People_To_First_Follower_And_Verify
56 [Documentation] Add all needed people to people first Follower, verify on each member.
57 ${people_items} = BuiltIn.Evaluate ${CARPEOPLE_ITEMS} * 4
58 CarPeople.Add_Several_People session=${people_first_follower_session} iterations=${people_items}
59 FOR ${session} IN @{ClusterManagement__session_list}
60 BuiltIn.Wait_Until_Keyword_Succeeds
63 ... TemplatedRequests.Get_As_Json_Templated
64 ... folder=${VAR_DIR}/people
65 ... session=${session}
67 ... iterations=${people_items}
70 Buy_Cars_On_Leader_And_Verify
71 [Documentation] Buy some cars on the leader member.
72 ${iter_start} = BuiltIn.Evaluate 0 * ${CARPEOPLE_ITEMS} + 1
73 CarPeople.Buy_Several_Cars
74 ... session=${car-people_leader_session}
75 ... iterations=${CARPEOPLE_ITEMS}
76 ... iter_start=${iter_start}
77 ${total_iterations} = BuiltIn.Evaluate 1 * ${CARPEOPLE_ITEMS}
78 FOR ${session} IN @{ClusterManagement__session_list}
79 BuiltIn.Wait_Until_Keyword_Succeeds
82 ... TemplatedRequests.Get_As_Json_Templated
83 ... folder=${VAR_DIR}/car-people
84 ... session=${session}
86 ... iterations=${total_iterations}
89 Buy_Cars_On_Follower_And_Verify
90 [Documentation] Buy some cars on the first follower member.
91 ${iter_start} = BuiltIn.Evaluate 1 * ${CARPEOPLE_ITEMS} + 1
92 CarPeople.Buy_Several_Cars
93 ... session=${car-people_first_follower_session}
94 ... iterations=${CARPEOPLE_ITEMS}
95 ... iter_start=${iter_start}
96 ${total_iterations} = BuiltIn.Evaluate 2 * ${CARPEOPLE_ITEMS}
97 FOR ${session} IN @{ClusterManagement__session_list}
98 BuiltIn.Wait_Until_Keyword_Succeeds
101 ... TemplatedRequests.Get_As_Json_Templated
102 ... folder=${VAR_DIR}/car-people
103 ... session=${session}
105 ... iterations=${total_iterations}
108 Isolate_and_Rejoin_People_Leader
109 [Documentation] Previous people Leader is isolated. We should never stop the people first follower, this is where people are registered.
110 ClusterManagement.Isolate_Member_From_List_Or_All ${people_leader_index}
111 BuiltIn.Wait_Until_Keyword_Succeeds
114 ... ClusterManagement.Verify_Shard_Leader_Elected
118 ... ${people_leader_index}
119 ... ${people_follower_indices}
120 ClusterManagement.Rejoin_Member_From_List_Or_All ${people_leader_index}
121 BuiltIn.Wait_Until_Keyword_Succeeds
124 ... ClusterManagement.Verify_Leader_Exists_For_Each_Shard
125 ... shard_name_list=${SHARD_NAME_LIST}
126 ... shard_type=config
128 Buy_Cars_On_Leader_After_Rejoin_And_Verify
129 [Documentation] Buy some cars on the leader member.
130 ${iter_start} = BuiltIn.Evaluate 2 * ${CARPEOPLE_ITEMS} + 1
131 CarPeople.Buy_Several_Cars
132 ... session=${car-people_leader_session}
133 ... iterations=${CARPEOPLE_ITEMS}
134 ... iter_start=${iter_start}
135 ${total_iterations} = BuiltIn.Evaluate 3 * ${CARPEOPLE_ITEMS}
136 FOR ${session} IN @{ClusterManagement__session_list}
137 BuiltIn.Wait_Until_Keyword_Succeeds
140 ... TemplatedRequests.Get_As_Json_Templated
141 ... folder=${VAR_DIR}/car-people
142 ... session=${session}
144 ... iterations=${total_iterations}
147 Buy_Cars_On_Follower_After_Rejoin_And_Verify
148 [Documentation] Buy some cars on the first follower member.
149 ${iter_start} = BuiltIn.Evaluate 3 * ${CARPEOPLE_ITEMS} + 1
150 CarPeople.Buy_Several_Cars
151 ... session=${car-people_first_follower_session}
152 ... iterations=${CARPEOPLE_ITEMS}
153 ... iter_start=${iter_start}
154 ${total_iterations} = BuiltIn.Evaluate 4 * ${CARPEOPLE_ITEMS}
155 FOR ${session} IN @{ClusterManagement__session_list}
156 BuiltIn.Wait_Until_Keyword_Succeeds
159 ... TemplatedRequests.Get_As_Json_Templated
160 ... folder=${VAR_DIR}/car-people
161 ... session=${session}
163 ... iterations=${total_iterations}
167 [Documentation] DELETE car-people container. No verification beyond http status.
168 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/car-people session=${car-people_leader_session}
171 [Documentation] DELETE people container. No verification beyond http status.
172 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/people session=${people_leader_session}
175 [Documentation] DELETE cars container. No verification beyond http status.
176 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/cars session=${car_leader_session}
181 [Documentation] Initialize resources, memorize shard leaders, compute item distribution.
182 SetupUtils.Setup_Utils_For_Setup_And_Teardown
183 Set_Variables_For_Shard shard_name=car
184 Set_Variables_For_Shard shard_name=people
185 Set_Variables_For_Shard shard_name=car-people
186 ${leader_list} = BuiltIn.Create_List ${car-people_leader_index}