7de7160a4e0a85f1a56c47816236f2bb932c2605
[integration/test.git] / test / csit / suites / clustering / datastore / 030_car_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
5 Library           ../../../libraries/CrudLibrary.py
6 Library           ../../../libraries/UtilLibrary.py
7 Library           ../../../libraries/ClusterStateLibrary.py
8 Resource           ../../../libraries/ClusterKeywords.txt
9
10 *** Variables ***
11 ${CAR_SHARD}      shard-car-config
12 ${NUM_CARS}  ${50}
13 ${NUM_ORIG_CARS}  ${10}
14
15 *** Test Cases ***
16 Get old car leader
17     ${OLD_CAR_LEADER}    Wait For Leader  ${CAR_SHARD}
18     Set Suite Variable    ${OLD_CAR_LEADER}
19
20 Delete cars on old leader
21     Delete All Cars And Verify   ${OLD_CAR_LEADER}
22
23 Add original cars on old leader
24     Add Cars And Verify  ${OLD_CAR_LEADER}  ${NUM_ORIG_CARS}
25
26 Switch car leader
27     [Documentation]  Stop the leader to cause a new leader to be elected
28     ${NEW_CAR_LEADER}  Switch Leader  ${CAR_SHARD}  ${OLD_CAR_LEADER}
29     Set Suite Variable  ${NEW_CAR_LEADER}
30
31 Get original cars on new leader
32     Wait Until Keyword Succeeds   60s  2s  Get Cars And Verify   ${NEW_CAR_LEADER}   ${NUM_ORIG_CARS}
33
34 Delete cars on new leader
35     Delete All Cars And Verify   ${NEW_CAR_LEADER}
36
37 Add new cars and get cars from new leader
38     [Documentation]    Add cars and get added cars from the Leader
39     Add Cars And Verify   ${NEW_CAR_LEADER}   ${NUM_CARS}
40
41 Get Car Followers
42     ${CAR_FOLLOWERS}   Get All Followers   ${CAR_SHARD}
43     Set Suite Variable  ${CAR_FOLLOWERS}
44
45 Get added cars from Follower
46     [Documentation]   Get the added cars from the Follower
47     Wait Until Keyword Succeeds   60s  2s  Get Cars And Verify   @{CAR_FOLLOWERS}[0]   ${NUM_CARS}
48
49 Delete cars on Follower
50     Delete All Cars And Verify   @{CAR_FOLLOWERS}[0]
51
52 Add cars from Follower
53     [Documentation]    Add more cars from the Follower
54     Add Cars And Verify   @{CAR_FOLLOWERS}[0]   ${NUM_CARS}
55
56 Get added cars from new leader
57     [Documentation]   Get added cars from the new leader
58     Wait Until Keyword Succeeds   60s  2s  Get Cars And Verify   ${NEW_CAR_LEADER}   ${NUM_CARS}
59
60 Restart old Car leader
61     StartController    ${OLD_CAR_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${PORT}
62
63 Get added cars from old leader
64     [Documentation]   Get the added cars from the old leader
65     Wait Until Keyword Succeeds   60s  2s  Get Cars And Verify   ${OLD_CAR_LEADER}   ${NUM_CARS}
66