326d2ba0b6a61daa3c10ac7d2d894561157255c3
[integration/test.git] / csit / suites / controller / Clustering_Datastore / 040_people_failover_crud_on_new_leader.robot
1 *** Settings ***
2 Documentation     This test brings down the current leader of the "car" shard and then executes CRUD operations on the new leader
3 Default Tags      3-node-cluster
4 Resource          ../../../libraries/ClusterKeywords.robot
5 Resource          ../../../libraries/CarsAndPeople.robot
6 Variables         ../../../variables/Variables.py
7
8 *** Variables ***
9 ${PEOPLE_SHARD}    shard-people-config
10 ${NUM_ENTRIES}    ${50}
11 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
12 ${START_TIMEOUT}    300s
13 ${STOP_TIMEOUT}    180s
14
15 *** Test Cases ***
16 Get Old People Leader
17     [Documentation]    Find leader in the people shard
18     ${OLD_PEOPLE_LEADER}    Get Leader And Verify    ${PEOPLE_SHARD}
19     Set Suite Variable    ${OLD_PEOPLE_LEADER}
20
21 Switch People Leader
22     [Documentation]    Stop the leader to cause a new leader to be elected
23     Stop One Or More Controllers    ${OLD_PEOPLE_LEADER}
24     Wait For Controller Down    ${STOP_TIMEOUT}    ${OLD_PEOPLE_LEADER}
25     ${NEW_PEOPLE_LEADER}    Wait Until Keyword Succeeds    30s    2s    Get Leader And Verify    ${PEOPLE_SHARD}    ${OLD_PEOPLE_LEADER}
26     Set Suite Variable    ${NEW_PEOPLE_LEADER}
27
28 Delete People From New Leader
29     [Documentation]    Delete people in new Leader
30     Delete All People And Verify    ${NEW_PEOPLE_LEADER}
31
32 Add People And Get From New Leader
33     [Documentation]    Add people and get people from new leader
34     Add People And Verify    ${NEW_PEOPLE_LEADER}    ${NUM_ENTRIES}
35
36 Get People Followers
37     [Documentation]    Find followers in the people shard
38     ${PEOPLE_FOLLOWERS}    Get All Followers    ${PEOPLE_SHARD}    ${OLD_PEOPLE_LEADER}
39     Set Suite Variable    ${PEOPLE_FOLLOWERS}
40
41 Get Added People From Follower
42     [Documentation]    Get people in follower and verify
43     Get People And Verify    @{PEOPLE_FOLLOWERS}[0]    ${NUM_ENTRIES}
44
45 Delete People From New Follower
46     [Documentation]    Delete people in follower and verify
47     Delete All People And Verify    @{PEOPLE_FOLLOWERS}[0]
48
49 Add People From New Follower
50     [Documentation]    Add people in follower and verify
51     Add People And Verify    @{PEOPLE_FOLLOWERS}[0]    ${NUM_ENTRIES}
52
53 Get Added People From New Leader
54     [Documentation]    Get people in Leader and verify
55     Get People And Verify    ${NEW_PEOPLE_LEADER}    ${NUM_ENTRIES}
56
57 Restart Old People Leader
58     [Documentation]    Start old people Leader
59     Start One Or More Controllers    ${OLD_PEOPLE_LEADER}
60     Wait For Controller Sync    ${START_TIMEOUT}    ${OLD_PEOPLE_LEADER}
61
62 Check Cars In Old People Leader
63     [Documentation]    Check cars in new Leader. This is to avoid delay when RPC does not work.
64     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars    ${OLD_PEOPLE_LEADER}    ${NUM_ENTRIES}
65
66 Get Added People From Old Leader
67     [Documentation]    Get people in old Leader and verify
68     Get People And Verify    ${OLD_PEOPLE_LEADER}    ${NUM_ENTRIES}