Upgrade RF syntax for v3.2 compatibility
[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 Suite Setup       Setup
16 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Default Tags      clustering    carpeople    critical
18 Library           Collections
19 Resource          ${CURDIR}/../../../libraries/CarPeople.robot
20 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
21 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
22 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
23 Variables         ${CURDIR}/../../../variables/Variables.py
24
25 *** Variables ***
26 ${CAR_ITEMS}      50
27 ${MEMBER_START_TIMEOUT}    300s
28 ${VAR_DIR}        ${CURDIR}/../../../variables/carpeople/crud
29
30 *** Test Cases ***
31 Add_Cars_On_Leader_And_Verify
32     [Documentation]    Single big PUT to datastore to add cars to car Leader.
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         BuiltIn.Wait_Until_Keyword_Succeeds    10s    2s    TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/cars    session=${session}
36         ...    verify=True    iterations=${CAR_ITEMS}
37     END
38
39 Stop_All_Members
40     [Documentation]    Stop all controllers.
41     ClusterManagement.Stop_Members_From_List_Or_All    confirm=True
42
43 Start_All_Members
44     [Documentation]    Start all controllers (should restore the persisted data).
45     ClusterManagement.Start_Members_From_List_Or_All    wait_for_sync=True    timeout=${MEMBER_START_TIMEOUT}
46
47 Memorize_Leader_And_Followers
48     [Documentation]    Locate current Leader of car Shard.
49     BuiltIn.Wait_Until_Keyword_Succeeds    30s    2s    CarPeople.Set_Variables_For_Shard    shard_name=car
50
51 See_Cars_On_Leader
52     [Documentation]    GET cars from Leader, should match the PUT data.
53     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}    verify=True    iterations=${CAR_ITEMS}
54
55 See_Cars_On_Followers
56     [Documentation]    The same check on other members.
57     FOR    ${session}    IN    @{car_follower_sessions}
58         TemplatedRequests.Get_As_Json_Templated    folder=${VAR_DIR}/cars    session=${session}    verify=True    iterations=${CAR_ITEMS}
59     END
60
61 Delete_Cars_On_Leader
62     [Documentation]    Delete cars on the new Leader.
63     TemplatedRequests.Delete_Templated    folder=${VAR_DIR}/cars    session=${car_leader_session}
64
65 *** Keywords ***
66 Setup
67     [Documentation]    Initialize resources, memorize car shard leader and followers.
68     SetupUtils.Setup_Utils_For_Setup_And_Teardown
69     CarPeople.Set_Variables_For_Shard    shard_name=car