2 Documentation This test focuses on testing buy-car RPC over 3 Leader reboots.
4 ... Copyright (c) 2016 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 rebooted.
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.
16 Default Tags clustering carpeople critical
18 Resource ${CURDIR}/../../../libraries/CarPeople.robot
19 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
20 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
21 Variables ${CURDIR}/../../../variables/Variables.py
24 ${CARPEOPLE_ITEMS} ${100}
25 ${MEMBER_START_TIMEOUT} 300s
26 @{SHARD_NAME_LIST} car people car-people
27 ${VAR_DIR} ${CURDIR}/../../../variables/carpeople/crud
30 Add_Cars_To_Leader_And_Verify
31 [Documentation] Add all needed cars to car Leader, verify on each member.
32 ${car_items} = BuiltIn.Evaluate ${CARPEOPLE_ITEMS} * 4
33 TemplatedRequests.Put_As_Json_Templated folder=${VAR_DIR}/cars session=${car_leader_session} iterations=${car_items}
34 : FOR ${session} IN @{ClusterManagement__session_list}
35 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/cars session=${session} verify=True iterations=${car_items}
37 Add_People_To_First_Follower_And_Verify
38 [Documentation] Add all needed people to people first Follower, verify on each member.
39 ${people_items} = BuiltIn.Evaluate ${CARPEOPLE_ITEMS} * 4
40 CarPeople.Add_Several_People session=${people_first_follower_session} iterations=${people_items}
41 : FOR ${session} IN @{ClusterManagement__session_list}
42 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/people session=${session} verify=True iterations=${people_items}
44 Buy_Cars_After_0_Reboots_And_Verify
45 [Documentation] Buy some cars on the test member.
46 ${iter_start} = BuiltIn.Evaluate 0 * ${CARPEOPLE_ITEMS} + 1
47 CarPeople.Buy_Several_Cars session=${buying_session} iterations=${CARPEOPLE_ITEMS} iter_start=${iter_start}
48 ${total_iterations} = BuiltIn.Evaluate 1 * ${CARPEOPLE_ITEMS}
49 : FOR ${session} IN @{ClusterManagement__session_list}
50 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/car-people session=${session} verify=True iterations=${total_iterations}
53 [Documentation] Previous car-people Leader is rebooted (without persistence cleanup).
54 ${index_to_reboot} = Collections.Remove_From_List ${list_to_reboot} 0
55 ClusterManagement.Kill_Single_Member ${index_to_reboot} confirm=True
56 ClusterManagement.Start_Single_Member ${index_to_reboot} wait_for_sync=True timeout=${MEMBER_START_TIMEOUT}
57 BuiltIn.Wait_Until_Keyword_Succeeds 30s 2s ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_NAME_LIST} shard_type=config
59 Buy_Cars_After_1_Reboots_And_Verify
60 [Documentation] Buy some cars on the test member.
61 ${iter_start} = BuiltIn.Evaluate 1 * ${CARPEOPLE_ITEMS} + 1
62 CarPeople.Buy_Several_Cars session=${buying_session} iterations=${CARPEOPLE_ITEMS} iter_start=${iter_start}
63 ${total_iterations} = BuiltIn.Evaluate 2 * ${CARPEOPLE_ITEMS}
64 : FOR ${session} IN @{ClusterManagement__session_list}
65 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/car-people session=${session} verify=True iterations=${total_iterations}
68 [Documentation] Previous car-people Leader is rebooted (without persistence cleanup).
69 ${index_to_reboot} = Collections.Remove_From_List ${list_to_reboot} 0
70 ClusterManagement.Kill_Single_Member ${index_to_reboot} confirm=True
71 ClusterManagement.Start_Single_Member ${index_to_reboot} wait_for_sync=True timeout=${MEMBER_START_TIMEOUT}
72 BuiltIn.Wait_Until_Keyword_Succeeds 30s 2s ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_NAME_LIST} shard_type=config
74 Buy_Cars_After_2_Reboots_And_Verify
75 [Documentation] Buy some cars on the test member.
76 ${iter_start} = BuiltIn.Evaluate 2 * ${CARPEOPLE_ITEMS} + 1
77 CarPeople.Buy_Several_Cars session=${buying_session} iterations=${CARPEOPLE_ITEMS} iter_start=${iter_start}
78 ${total_iterations} = BuiltIn.Evaluate 3 * ${CARPEOPLE_ITEMS}
79 : FOR ${session} IN @{ClusterManagement__session_list}
80 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/car-people session=${session} verify=True iterations=${total_iterations}
83 [Documentation] Previous car-people Leader is rebooted (without persistence cleanup).
84 ${index_to_reboot} = Collections.Remove_From_List ${list_to_reboot} 0
85 ClusterManagement.Kill_Single_Member ${index_to_reboot} confirm=True
86 ClusterManagement.Start_Single_Member ${index_to_reboot} wait_for_sync=True timeout=${MEMBER_START_TIMEOUT}
87 BuiltIn.Wait_Until_Keyword_Succeeds 30s 2s ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_NAME_LIST} shard_type=config
89 Buy_Cars_After_3_Reboots_And_Verify
90 [Documentation] Buy some cars on the test member.
91 ${iter_start} = BuiltIn.Evaluate 3 * ${CARPEOPLE_ITEMS} + 1
92 CarPeople.Buy_Several_Cars session=${buying_session} iterations=${CARPEOPLE_ITEMS} iter_start=${iter_start}
93 ${total_iterations} = BuiltIn.Evaluate 4 * ${CARPEOPLE_ITEMS}
94 : FOR ${session} IN @{ClusterManagement__session_list}
95 \ TemplatedRequests.Get_As_Json_Templated folder=${VAR_DIR}/car-people session=${session} verify=True iterations=${total_iterations}
98 [Documentation] DELETE car-people container. No verification beyond http status.
99 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/car-people session=${buying_session}
102 [Documentation] DELETE people container. No verification beyond http status.
103 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/people session=${people_leader_session}
106 [Documentation] DELETE cars container. No verification beyond http status.
107 TemplatedRequests.Delete_Templated folder=${VAR_DIR}/cars session=${car_leader_session}
111 [Documentation] Initialize resources, memorize shard leaders, compute item distribution.
112 ClusterManagement.ClusterManagement_Setup
113 Set_Variables_For_Shard shard_name=car
114 Set_Variables_For_Shard shard_name=people
115 Set_Variables_For_Shard shard_name=car-people
116 ${leader_list} = BuiltIn.Create_List ${car-people_leader_index}
117 ${reboot_list} = Collections.Combine_Lists ${leader_list} ${car-people_follower_indices}
118 BuiltIn.Set_Suite_Variable \${list_to_reboot} ${reboot_list}
119 BuiltIn.Set_Suite_Variable \${buying_session} ${car-people_leader_session}