Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / controller / Clustering_Datastore / 010_crud_on_leader.robot
1 *** Settings ***
2 Documentation     This test finds the leader for shards in a 3-Node cluster and executes CRUD operations on them
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 ${SHARD_CAR_NAME}    shard-car-config
16 ${SHARD_PEOPLE_NAME}    shard-people-config
17 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
18 ${NUM_ENTRIES}    ${30}
19
20 *** Test Cases ***
21 Get Car Leader And Followers
22     ${CURRENT_CAR_LEADER}    Wait For Leader To Be Found    ${SHARD_CAR_NAME}
23     Set Suite Variable    ${CURRENT_CAR_LEADER}
24     ${CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
25     Set Suite Variable    ${CAR_FOLLOWERS}
26
27 Add cars and get cars from Leader
28     [Documentation]    Add some cars and get added cars from Leader
29     Add Cars And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
30
31 Get added cars from Follower1
32     [Documentation]    Get added cars from Follower1
33     Wait Until Keyword Succeeds    60s    2s    Get Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
34
35 Get added cars from Follower2
36     [Documentation]    Get added cars from Follower2
37     Wait Until Keyword Succeeds    60s    2s    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_ENTRIES}
38
39 Get People Leader And Followers
40     ${CURRENT_PEOPLE_LEADER}    Wait For Leader To Be Found    ${SHARD_PEOPLE_NAME}
41     Set Suite Variable    ${CURRENT_PEOPLE_LEADER}
42     ${PEOPLE_FOLLOWERS}    Get All Followers    ${SHARD_PEOPLE_NAME}
43     Set Suite Variable    ${PEOPLE_FOLLOWERS}
44
45 Add people and get people from Leader
46     [Documentation]    Add some people and get people from Leader.
47     Add People And Verify    ${CURRENT_PEOPLE_LEADER}    ${NUM_ENTRIES}
48
49 Get added people from Follower1
50     [Documentation]    Get added people from Follower1
51     Wait Until Keyword Succeeds    60s    2s    Get People And Verify    @{PEOPLE_FOLLOWERS}[0]    ${NUM_ENTRIES}
52
53 Get added people from Follower2
54     [Documentation]    Get added people from Follower2
55     Wait Until Keyword Succeeds    60s    2s    Get People And Verify    @{PEOPLE_FOLLOWERS}[1]    ${NUM_ENTRIES}
56
57 Get Car-Person Leader And Followers
58     ${CURRENT_CAR_PERSON_LEADER}    Wait For Leader To Be Found    ${SHARD_CAR_PERSON_NAME}
59     Set Suite Variable    ${CURRENT_CAR_PERSON_LEADER}
60     ${CAR_PERSON_FOLLOWERS}    Get All Followers    ${SHARD_CAR_PERSON_NAME}
61     Set Suite Variable    ${CAR_PERSON_FOLLOWERS}
62
63 Add car-person mapping and get car-person mapping from Leader
64     Add Car Person And Verify    ${CURRENT_CAR_PERSON_LEADER}
65
66 Purchase cars on Leader
67     [Documentation]    Purchase some cars on the Leader
68     ${NUM_BUY_CARS_ON_LEADER}    Evaluate    ${NUM_ENTRIES}/3
69     ${NUM_BUY_CARS_ON_FOLLOWER1}    Evaluate    ${NUM_ENTRIES}/3
70     ${NUM_BUY_CARS_ON_FOLLOWER2}    Evaluate    ${NUM_ENTRIES}-${NUM_BUY_CARS_ON_LEADER}-${NUM_BUY_CARS_ON_FOLLOWER1}
71     Set Suite Variable    ${NUM_BUY_CARS_ON_LEADER}
72     Set Suite Variable    ${NUM_BUY_CARS_ON_FOLLOWER1}
73     Set Suite Variable    ${NUM_BUY_CARS_ON_FOLLOWER2}
74     Buy Cars And Verify    ${CURRENT_CAR_PERSON_LEADER}    ${NUM_BUY_CARS_ON_LEADER}
75
76 Purchase cars on Follower1
77     [Documentation]    Purchase some cars on Follower1
78     Buy Cars And Verify    @{CAR_PERSON_FOLLOWERS}[0]    ${NUM_BUY_CARS_ON_FOLLOWER1}    ${NUM_BUY_CARS_ON_LEADER}
79
80 Purchase cars on Follower2
81     [Documentation]    Purchase some cars on Follower2
82     ${start}    Evaluate    ${NUM_BUY_CARS_ON_LEADER}+${NUM_BUY_CARS_ON_FOLLOWER1}
83     Buy Cars And Verify    @{CAR_PERSON_FOLLOWERS}[1]    ${NUM_BUY_CARS_ON_FOLLOWER2}    ${start}
84
85 Get car-person mappings from Leader
86     [Documentation]    Get car-person mappings from Leader to see all entries
87     Wait Until Keyword Succeeds    60s    2s    Get Car-Person Mappings And Verify    ${CURRENT_CAR_PERSON_LEADER}    ${NUM_ENTRIES}
88
89 Get car-person mappings from Follower1
90     [Documentation]    Get car-person mappings from Follower1 to see all entries
91     Wait Until Keyword Succeeds    60s    2s    Get Car-Person Mappings And Verify    @{CAR_PERSON_FOLLOWERS}[0]    ${NUM_ENTRIES}
92
93 Get car-person mappings from Follower2
94     [Documentation]    Get car-person mappings from Follower2 to see all entries
95     Wait Until Keyword Succeeds    60s    2s    Get Car-Person Mappings And Verify    @{CAR_PERSON_FOLLOWERS}[1]    ${NUM_ENTRIES}