Update Robot Framework format - step 5
[integration/test.git] / csit / suites / controller / Clustering_Datastore / car_persistence_recovery.robot
1 *** Settings ***
2 Documentation       This test restarts all controllers to verify recovery of car data from persistence.
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 ...                 Other models and shards (people, car-people) are not accessed by this suite.
12 ...
13 ...                 All data is deleted at the end of the suite.
14 ...                 This suite expects car module to have a separate Shard.
15
16 Library             Collections
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
22
23 Suite Setup         Setup
24 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
25
26 Default Tags        clustering    carpeople    critical
27
28
29 *** Variables ***
30 ${CAR_ITEMS}                50
31 ${MEMBER_START_TIMEOUT}     300s
32 ${VAR_DIR}                  ${CURDIR}/../../../variables/carpeople/crud
33
34
35 *** Test Cases ***
36 Add_Cars_On_Leader_And_Verify
37     [Documentation]    Single big PUT to datastore to add cars to car Leader.
38     TemplatedRequests.Put_As_Json_Templated
39     ...    folder=${VAR_DIR}/cars
40     ...    session=${car_leader_session}
41     ...    iterations=${CAR_ITEMS}
42     FOR    ${session}    IN    @{ClusterManagement__session_list}
43         BuiltIn.Wait_Until_Keyword_Succeeds
44         ...    10s
45         ...    2s
46         ...    TemplatedRequests.Get_As_Json_Templated
47         ...    folder=${VAR_DIR}/cars
48         ...    session=${session}
49         ...    verify=True
50         ...    iterations=${CAR_ITEMS}
51     END
52
53 Stop_All_Members
54     [Documentation]    Stop all controllers.
55     ClusterManagement.Stop_Members_From_List_Or_All    confirm=True
56
57 Start_All_Members
58     [Documentation]    Start all controllers (should restore the persisted data).
59     ClusterManagement.Start_Members_From_List_Or_All    wait_for_sync=True    timeout=${MEMBER_START_TIMEOUT}
60
61 Memorize_Leader_And_Followers
62     [Documentation]    Locate current Leader of car Shard.
63     BuiltIn.Wait_Until_Keyword_Succeeds    30s    2s    CarPeople.Set_Variables_For_Shard    shard_name=car
64
65 See_Cars_On_Leader
66     [Documentation]    GET cars from Leader, should match the PUT data.
67     TemplatedRequests.Get_As_Json_Templated
68     ...    folder=${VAR_DIR}/cars
69     ...    session=${car_leader_session}
70     ...    verify=True
71     ...    iterations=${CAR_ITEMS}
72
73 See_Cars_On_Followers
74     [Documentation]    The same check on other members.
75     FOR    ${session}    IN    @{car_follower_sessions}
76         TemplatedRequests.Get_As_Json_Templated
77         ...    folder=${VAR_DIR}/cars
78         ...    session=${session}
79         ...    verify=True
80         ...    iterations=${CAR_ITEMS}
81     END
82
83 Delete_Cars_On_Leader
84     [Documentation]    Delete cars on the new Leader.
85     TemplatedRequests.Delete_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}
86
87
88 *** Keywords ***
89 Setup
90     [Documentation]    Initialize resources, memorize car shard leader and followers.
91     SetupUtils.Setup_Utils_For_Setup_And_Teardown
92     CarPeople.Set_Variables_For_Shard    shard_name=car