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