Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / controller / Clustering_Datastore / 140_recovery_restart_follower.robot
1 *** Settings ***
2 Documentation     This test kills any of the followers and verifies that when that follower is restarted it can join the cluster
3 Default Tags      3-node-cluster
4 Library           Collections
5 Library           RequestsLibrary
6 Library           ../../../libraries/Common.py
7 Library           ../../../libraries/CrudLibrary.py
8 Library           ../../../libraries/SettingsLibrary.py
9 Library           ../../../libraries/UtilLibrary.py
10 Library           ../../../libraries/ClusterStateLibrary.py
11 Resource          ../../../libraries/ClusterKeywords.robot
12 Variables         ../../../variables/Variables.py
13
14 *** Variables ***
15 ${CAR_SHARD}      shard-car-config
16 ${NUM_CARS}       ${60}
17 @{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
18 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
19
20 *** Test Cases ***
21 Stop All Controllers
22     [Documentation]    Stop all the controllers in the cluster
23     Stop One Or More Controllers    @{controllers}
24
25 Clean All Journals
26     [Documentation]    Clean the journals of all the controllers in the cluster
27     Clean One Or More Journals    @{controllers}
28
29 Start All Controllers
30     [Documentation]    Start all the controllers in the cluster
31     Start One Or More Controllers    @{controllers}
32
33 Get car leader and followers
34     ${CURRENT_CAR_LEADER}    Wait For Leader To Be Found    ${CAR_SHARD}
35     Set Suite Variable    ${CURRENT_CAR_LEADER}
36     ${CAR_FOLLOWERS}    Get All Followers    ${CAR_SHARD}
37     Set Suite Variable    ${CAR_FOLLOWERS}
38
39 Stop both of the followers
40     @{followers} =    Create List    @{CAR_FOLLOWERS}[0]    @{CAR_FOLLOWERS}[1]
41     Stop One Or More Controllers    @{followers}
42
43 Attempt to add a car to the leader
44     [Documentation]    Should fail as both followers are down
45     AddCar    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}    500
46     Sleep    2
47     ${resp}    Getcars    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}
48     Should Not Be Equal As Strings    ${resp.status_code}    200
49
50 Restart the first follower
51     Start One Or More Controllers    @{CAR_FOLLOWERS}[0]
52
53 Add cars to the first follower
54     Log    Adding ${NUM_CARS} cars to @{CAR_FOLLOWERS}[0]
55     Add Cars And Verify Without Init    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}    4s
56
57 Restart the second follower
58     Start One Or More Controllers    @{CAR_FOLLOWERS}[1]
59
60 Get all the cars from the second follower
61     Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}
62
63 *** Keywords ***
64 Expect No Leader
65     ${leader}    GetLeader    ${CAR_SHARD}    ${3}    ${1}    ${1}    ${RESTCONFPORT}
66     ...    ${CURRENT_CAR_LEADER}
67     Should Be Equal As Strings    ${leader}    None