32fc8672be8a9b00548f2ff02ef38431f9871ca5
[integration/test.git] / 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 Resource          ../../../libraries/ClusterKeywords.robot
5 Resource          ../../../libraries/CarsAndPeople.robot
6 Variables         ../../../variables/Variables.py
7
8 *** Variables ***
9 ${SHARD_CAR_NAME}    shard-car-config
10 ${SHARD_PEOPLE_NAME}    shard-people-config
11 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
12 ${NUM_ENTRIES}    ${30}
13
14 *** Test Cases ***
15 Get Car Leader And Followers
16     [Documentation]    Find leader and followers in the car shard
17     ${CURRENT_CAR_LEADER}    Get Leader And Verify    ${SHARD_CAR_NAME}
18     Set Suite Variable    ${CURRENT_CAR_LEADER}
19     ${CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
20     Set Suite Variable    ${CAR_FOLLOWERS}
21
22 Add Cars And Get Cars From Leader
23     [Documentation]    Add some cars and get added cars from Leader
24     Add Cars And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
25
26 Get Added Cars From Follower1
27     [Documentation]    Get added cars from Follower1
28     Get Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
29
30 Get Added Cars From Follower2
31     [Documentation]    Get added cars from Follower2
32     Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_ENTRIES}
33
34 Get People Leader And Followers
35     [Documentation]    Find leader and followers in the people shard
36     ${CURRENT_PEOPLE_LEADER}    Get Leader And Verify    ${SHARD_PEOPLE_NAME}
37     Set Suite Variable    ${CURRENT_PEOPLE_LEADER}
38     ${PEOPLE_FOLLOWERS}    Get All Followers    ${SHARD_PEOPLE_NAME}
39     Set Suite Variable    ${PEOPLE_FOLLOWERS}
40
41 Add People And Get People From Leader
42     [Documentation]    Add some people and get people from Leader.
43     Add People And Verify    ${CURRENT_PEOPLE_LEADER}    ${NUM_ENTRIES}
44
45 Get Added People From Follower1
46     [Documentation]    Get added people from Follower1
47     Get People And Verify    @{PEOPLE_FOLLOWERS}[0]    ${NUM_ENTRIES}
48
49 Get Added People From Follower2
50     [Documentation]    Get added people from Follower2
51     Get People And Verify    @{PEOPLE_FOLLOWERS}[1]    ${NUM_ENTRIES}
52
53 Get Car-Person Leader And Followers
54     [Documentation]    Find leader and followers in the car-person shard
55     ${CURRENT_CAR_PERSON_LEADER}    Get Leader And Verify    ${SHARD_CAR_PERSON_NAME}
56     Set Suite Variable    ${CURRENT_CAR_PERSON_LEADER}
57     ${CAR_PERSON_FOLLOWERS}    Get All Followers    ${SHARD_CAR_PERSON_NAME}
58     Set Suite Variable    ${CAR_PERSON_FOLLOWERS}
59
60 Add Car-Person Mapping And Get Car-Person Mapping From Leader
61     [Documentation]    Initialize car-person shard
62     Add Car Person And Verify    ${CURRENT_CAR_PERSON_LEADER}
63
64 Purchase Cars On Leader
65     [Documentation]    Purchase some cars on the Leader
66     ${NUM_BUY_CARS_ON_LEADER}    Evaluate    ${NUM_ENTRIES}/3
67     ${NUM_BUY_CARS_ON_FOLLOWER1}    Evaluate    ${NUM_ENTRIES}/3
68     ${NUM_BUY_CARS_ON_FOLLOWER2}    Evaluate    ${NUM_ENTRIES}-${NUM_BUY_CARS_ON_LEADER}-${NUM_BUY_CARS_ON_FOLLOWER1}
69     Set Suite Variable    ${NUM_BUY_CARS_ON_LEADER}
70     Set Suite Variable    ${NUM_BUY_CARS_ON_FOLLOWER1}
71     Set Suite Variable    ${NUM_BUY_CARS_ON_FOLLOWER2}
72     Buy Cars And Verify    ${CURRENT_CAR_PERSON_LEADER}    ${NUM_BUY_CARS_ON_LEADER}
73
74 Purchase Cars On Follower1
75     [Documentation]    Purchase some cars on Follower1
76     Buy Cars And Verify    @{CAR_PERSON_FOLLOWERS}[0]    ${NUM_BUY_CARS_ON_FOLLOWER1}    ${NUM_BUY_CARS_ON_LEADER}
77
78 Purchase Cars On Follower2
79     [Documentation]    Purchase some cars on Follower2
80     ${start}    Evaluate    ${NUM_BUY_CARS_ON_LEADER}+${NUM_BUY_CARS_ON_FOLLOWER1}
81     Buy Cars And Verify    @{CAR_PERSON_FOLLOWERS}[1]    ${NUM_BUY_CARS_ON_FOLLOWER2}    ${start}
82
83 Get Car-Person Mappings From Leader
84     [Documentation]    Get car-person mappings from Leader to see all entries
85     Get Car-Person Mappings And Verify    ${CURRENT_CAR_PERSON_LEADER}    ${NUM_ENTRIES}
86
87 Get Car-Person Mappings From Follower1
88     [Documentation]    Get car-person mappings from Follower1 to see all entries
89     Get Car-Person Mappings And Verify    @{CAR_PERSON_FOLLOWERS}[0]    ${NUM_ENTRIES}
90
91 Get Car-Person Mappings From Follower2
92     [Documentation]    Get car-person mappings from Follower2 to see all entries
93     Get Car-Person Mappings And Verify    @{CAR_PERSON_FOLLOWERS}[1]    ${NUM_ENTRIES}