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