Tolerate timeout when accessing isolated member
[integration/test.git] / csit / suites / controller / Clustering_Datastore / carpeople_crud.robot
1 *** Settings ***
2 Documentation     Suite for performing basic car/people CRUD operations on leaders and followers.
3 ...
4 ...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
5 ...
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
9 ...
10 ...
11 ...               More precisely, Update operation is not executed, but some operations
12 ...               are using specific RPCs which goes beyond "basic CRUD".
13 ...
14 ...               Cars are added by one big PUT to datastore on car Leader.
15 ...               People are added in a loop with add-person RPC on a people Follower.
16 ...               Cars are bought by chunks on each member, by loop with buy-car RPC.
17 ...
18 ...               All data is deleted at the end of the suite.
19 ...               This suite expects car, people and car-people modules to have separate Shards.
20 Suite Setup       Setup
21 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
22 Default Tags      clustering    carpeople    critical
23 Library           Collections
24 Resource          ${CURDIR}/../../../libraries/CarPeople.robot
25 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
26 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
27 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
28 Variables         ${CURDIR}/../../../variables/Variables.py
29
30 *** Variables ***
31 ${CARPEOPLE_ITEMS}    ${30}
32 ${VAR_DIR}        ${CURDIR}/../../../variables/carpeople/crud
33
34 *** Test Cases ***
35 Add_Cars_To_Leader
36     [Documentation]    Add ${CARPEOPLE_ITEMS} cars to car Leader by one big PUT.
37     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}    iterations=${CARPEOPLE_ITEMS}
38
39 See_Added_Cars_On_Leader
40     [Documentation]    GET response from Leader should match the PUT data.
41     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}    verify=True    iterations=${CARPEOPLE_ITEMS}
42
43 See_Added_Cars_On_Followers
44     [Documentation]    The same check on other members.
45     : FOR    ${session}    IN    @{car_follower_sessions}
46     \    TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/cars    session=${session}    verify=True    iterations=${CARPEOPLE_ITEMS}
47
48 Add_People_To_First_Follower
49     [Documentation]    Add ${CARPEOPLE_ITEMS} people to people first Follower, loop of add-person.
50     CarPeople.Add_Several_People    session=${people_first_follower_session}    iterations=${CARPEOPLE_ITEMS}
51
52 See_Added_People_On_Leader
53     [Documentation]    GET response from Leader should match the added people.
54     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/people    session=${people_leader_session}    verify=True    iterations=${CARPEOPLE_ITEMS}
55
56 See_Added_People_On_Followers
57     [Documentation]    The same check on other members.
58     : FOR    ${session}    IN    @{people_follower_sessions}
59     \    TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/people    session=${session}    verify=True    iterations=${CARPEOPLE_ITEMS}
60
61 Buy_Cars_On_Leader
62     [Documentation]    Buy some cars on car-people Leader, loop of buy-car, ending segment of IDs.
63     # Cars are numbered, leader gets chunk at the end, as that is few keypresses shorter.
64     ${start_id} =    BuiltIn.Evaluate    (${NUM_ODL_SYSTEM} - 1) * ${items_per_follower} + 1
65     CarPeople.Buy_Several_Cars    session=${car-people_leader_session}    iterations=${items_per_leader}    iter_start=${start_id}
66
67 Buy_Cars_On_Followers
68     [Documentation]    On each Follower buy corresponding ID segment of cars in buy-car loop.
69     ${start_id} =    BuiltIn.Set_Variable    1
70     : FOR    ${session}    IN    @{car-people_follower_sessions}
71     \    CarPeople.Buy_Several_Cars    session=${session}    iterations=${items_per_follower}    iter_start=${start_id}
72     \    ${start_id} =    BuiltIn.Evaluate    ${start_id} + ${items_per_follower}
73
74 See_Added_CarPeople_On_Leader
75     [Documentation]    GET car-person mappings from Leader to see all entries.
76     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/car-people    session=${car-people_leader_session}    verify=True    iterations=${CARPEOPLE_ITEMS}
77
78 See_Added_CarPeople_On_Followers
79     [Documentation]    The same check on other members.
80     : FOR    ${session}    IN    @{car-people_follower_sessions}
81     \    TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/car-people    session=${session}    verify=True    iterations=${CARPEOPLE_ITEMS}
82
83 Delete_All_CarPeople_On_Leader
84     [Documentation]    DELETE car-people container. No verification beyond http status.
85     TemplatedRequests.Delete_Templated    folder=${VAR_DIR}/car-people    session=${car-people_leader_session}
86
87 Delete_All_People_On_Leader
88     [Documentation]    DELETE people container. No verification beyond http status.
89     TemplatedRequests.Delete_Templated    folder=${VAR_DIR}/people    session=${people_leader_session}
90
91 Delete_All_Cars_On_Leader
92     [Documentation]    DELETE cars container. No verification beyond http status.
93     TemplatedRequests.Delete_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}
94
95 *** Keywords ***
96 Setup
97     [Documentation]    Initialize resources, memorize shard leaders, compute item distribution.
98     SetupUtils.Setup_Utils_For_Setup_And_Teardown
99     CarPeople.Set_Variables_For_Shard    shard_name=car
100     CarPeople.Set_Variables_For_Shard    shard_name=people
101     CarPeople.Set_Variables_For_Shard    shard_name=car-people
102     ${follower_number} =    BuiltIn.Evaluate    ${CARPEOPLE_ITEMS} / ${NUM_ODL_SYSTEM}
103     BuiltIn.Set_Suite_Variable    ${items_per_follower}    ${follower_number}
104     ${leader_number} =    BuiltIn.Evaluate    ${CARPEOPLE_ITEMS} - (${NUM_ODL_SYSTEM} - 1) * ${follower_number}
105     BuiltIn.Set_Suite_Variable    ${items_per_leader}    ${leader_number}