Enhancements to 3-node cluster tests
[integration/test.git] / test / csit / suites / clustering / datastore / 020_crud_on_any_follower.txt
1 *** Settings ***
2 Documentation     This test finds the followers of certain shards in a 3-Node cluster and executes CRUD operations on any one follower
3
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 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${REST_CONTEXT}    /restconf/config/
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}  ${40}
19
20 *** Test Cases ***
21 Get Car Followers
22     ${CAR_FOLLOWERS}   GetFollowers   ${SHARD_CAR_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
23     Log    ${CAR_FOLLOWERS}
24     SET SUITE VARIABLE  ${CAR_FOLLOWERS}
25
26 Get People Followers
27     ${PEOPLE_FOLLOWERS}   GetFollowers   ${SHARD_PEOPLE_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
28     Log    ${PEOPLE_FOLLOWERS}
29     SET SUITE VARIABLE  ${PEOPLE_FOLLOWERS}
30
31 Get Car-Person Followers
32     ${CAR_PERSON_FOLLOWERS}   GetFollowers   ${SHARD_CAR_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
33     Log    ${CAR_PERSON_FOLLOWERS}
34     SET SUITE VARIABLE  ${CAR_PERSON_FOLLOWERS}
35
36 Delete cars from Follower1
37     DeleteAllCars    @{CAR_FOLLOWERS}[0]    ${PORT}    ${0}
38     ${resp}    Getcars    @{CAR_FOLLOWERS}[0]    ${PORT}    ${0}
39     Should Be Equal As Strings    ${resp.status_code}    404
40
41 Delete people from Follower1
42     DeleteAllPersons    @{PEOPLE_FOLLOWERS}[0]    ${PORT}    ${0}
43     ${resp}         GetPersons      @{PEOPLE_FOLLOWERS}[0]   ${PORT}    ${0}
44     Should Be Equal As Strings    ${resp.status_code}    404
45
46 Delete car-persons from Follower1
47     DeleteAllCarsPersons    @{CAR_PERSON_FOLLOWERS}[0]    ${PORT}    ${0}
48     ${resp}         GetCarPersonMappings      @{CAR_PERSON_FOLLOWERS}[0]   ${PORT}    ${0}
49     Should Be Equal As Strings    ${resp.status_code}    404
50
51 Add cars and get cars from Follower1
52     [Documentation]    Add cars and get added cars from Follower1
53     ${resp}             AddCar  @{CAR_FOLLOWERS}[0]     ${PORT} ${NUM_ENTRIES}
54     ${resp}             Getcars @{CAR_FOLLOWERS}[0]     ${PORT} ${0}
55     Should Be Equal As Strings    ${resp.status_code}    200
56     :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
57     \    Should Contain     ${resp.content}   manufacturer${i}
58
59 Get added cars using Follower2
60    [Documentation]   Get added cars using Follower2
61    ${resp}             Getcars  @{CAR_FOLLOWERS}[1]  ${PORT}  ${0}
62    Should Be Equal As Strings    ${resp.status_code}    200
63    :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
64    \    Should Contain     ${resp.content}   manufacturer${i}
65
66 Add persons and get persons from Follower1
67     [Documentation]    Add persons and get persons from Follower1
68     [Documentation]    Note: There should be one person added first to enable rpc
69     ${resp}             AddPerson       @{PEOPLE_FOLLOWERS}[0]  ${PORT} ${0}
70     ${resp}             AddPerson       @{PEOPLE_FOLLOWERS}[0]  ${PORT} ${NUM_ENTRIES}
71     Sleep               5
72     ${resp}             GetPersons      @{PEOPLE_FOLLOWERS}[0]  ${PORT} ${0}
73     Should Be Equal As Strings    ${resp.status_code}    200
74     :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
75     \    Should Contain     ${resp.content}   user${i}
76
77 Add car-person mapping and get car-person mapping from Follower1
78     [Documentation]    Add car-person and get car-person from Follower1
79     [Documentation]    Note: This is done to enable working of rpc
80
81     ${resp}             AddCarPerson    @{CAR_PERSON_FOLLOWERS}[0]      ${PORT} ${0}
82     Sleep    1
83     ${resp}             GetCarPersonMappings    @{CAR_PERSON_FOLLOWERS}[0]      ${PORT} ${0}
84     Should Be Equal As Strings    ${resp.status_code}    200
85     Should Contain     ${resp.content}   user0
86
87 Purchase cars using Follower1
88     [Documentation]  Purchase cars using Follower1
89     ${resp}             BuyCar  @{CAR_PERSON_FOLLOWERS}[0]      ${PORT} ${NUM_ENTRIES}
90     Sleep   5
91
92 Get car-person mappings using Follower1
93     [Documentation]     Get car-person mappings using follower1 to see 100 entry
94     ${resp}             GetCarPersonMappings    @{CAR_PERSON_FOLLOWERS}[0]      ${PORT} ${0}
95     Should Be Equal As Strings    ${resp.status_code}    200
96     :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
97     \    Should Contain     ${resp.content}   user${i}
98
99 Get car-person mappings using Leader
100     [Documentation]     Get car-person mappings using Leader to see 100 entry
101     ${CURRENT_CAR_LEADER}   GetLeader   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
102     Log     ${CURRENT_CAR_LEADER}
103     Sleep   1
104     ${resp}             GetCarPersonMappings    ${CURRENT_CAR_LEADER}   ${PORT} ${0}
105     Should Be Equal As Strings    ${resp.status_code}    200
106     :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
107     \    Should Contain     ${resp.content}   user${i}
108
109 Get car-person mappings using Follower2
110     [Documentation]     Get car-person mappings using Follower2 to see 100 entry
111     ${resp}             GetCarPersonMappings    @{CAR_PERSON_FOLLOWERS}[1]      ${PORT} ${0}
112     Should Be Equal As Strings    ${resp.status_code}    200
113     :FOR    ${i}    IN RANGE    1    ${NUM_ENTRIES}
114     \    Should Contain     ${resp.content}   user${i}