2 Documentation This test brings down the current leader of the "car" shard and then executes CRUD operations on the new leader
3 Library ../../../libraries/CrudLibrary.py
4 Library ../../../libraries/UtilLibrary.py
5 Library ../../../libraries/ClusterStateLibrary.py
8 ${PEOPLE_SHARD} shard-people-config
13 [Documentation] stop leader and elect new leader
14 ${OLD_PEOPLE_LEADER} GetLeader ${PEOPLE_SHARD} ${3} ${3} ${2} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
15 Stopcontroller ${OLD_PEOPLE_LEADER} ${USERNAME} ${PASSWORD} ${KARAFHOME}
17 ${NEW_PEOPLE_LEADER} GetLeader ${PEOPLE_SHARD} ${3} ${3} ${2} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
18 Log ${NEW_PEOPLE_LEADER}
19 Should Not Be Equal As Strings ${NEW_PEOPLE_LEADER} None
20 Should Not Be Equal ${OLD_PEOPLE_LEADER} ${NEW_PEOPLE_LEADER}
21 Set Suite Variable ${NEW_PEOPLE_LEADER}
22 Set Suite Variable ${OLD_PEOPLE_LEADER}
24 Delete people from new leader
25 [Documentation] delete people
26 DeleteAllPersons ${NEW_PEOPLE_LEADER} ${PORT} ${0}
27 ${resp} GetPersons ${NEW_PEOPLE_LEADER} ${PORT} ${0}
28 Should Be Equal As Strings ${resp.status_code} 404
30 Add persons and get from new leader
31 [Documentation] Add persons and get persons from new leader
32 [Documentation] Note: There should be one person added first to enable rpc
33 ${resp} AddPerson ${NEW_PEOPLE_LEADER} ${PORT} ${0}
34 ${resp} AddPerson ${NEW_PEOPLE_LEADER} ${PORT} ${NUM_ENTRIES}
36 ${resp} GetPersons ${NEW_PEOPLE_LEADER} ${PORT} ${0}
37 Should Be Equal As Strings ${resp.status_code} 200
38 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
39 \ Should Contain ${resp.content} user${i}
42 ${PEOPLE_FOLLOWERS} GetFollowers ${PEOPLE_SHARD} ${3} ${3} ${1} ${PORT} ${MEMBER1} ${MEMBER2} ${MEMBER3}
43 Log ${PEOPLE_FOLLOWERS}
44 SET SUITE VARIABLE ${PEOPLE_FOLLOWERS}
46 Get added persons from follower
47 ${resp} GetPersons @{PEOPLE_FOLLOWERS}[0] ${PORT} ${0}
48 Should Be Equal As Strings ${resp.status_code} 200
49 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
50 \ Should Contain ${resp.content} user${i}
52 Delete people from new Follower
53 [Documentation] delete people
54 DeleteAllPersons @{PEOPLE_FOLLOWERS}[0] ${PORT} ${0}
55 ${resp} GetPersons @{PEOPLE_FOLLOWERS}[0] ${PORT} ${0}
56 Should Be Equal As Strings ${resp.status_code} 404
58 Add persons from new Follower
59 [Documentation] Add persons and get persons from follower
60 [Documentation] Note: There should be one person added first to enable rpc
61 ${resp} AddPerson @{PEOPLE_FOLLOWERS}[0] ${PORT} ${0}
62 ${resp} AddPerson @{PEOPLE_FOLLOWERS}[0] ${PORT} ${NUM_ENTRIES}
64 ${resp} GetPersons @{PEOPLE_FOLLOWERS}[0] ${PORT} ${0}
65 Should Be Equal As Strings ${resp.status_code} 200
66 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
67 \ Should Contain ${resp.content} user${i}
69 Get added persons from new leader
70 ${resp} GetPersons ${NEW_PEOPLE_LEADER} ${PORT} ${0}
71 Should Be Equal As Strings ${resp.status_code} 200
72 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
73 \ Should Contain ${resp.content} user${i}
75 Restart old People leader
76 Startcontroller ${OLD_PEOPLE_LEADER} ${USER_NAME} ${PASSWORD} ${KARAF_HOME} ${PORT}
79 Get added persons from old leader
80 ${resp} GetPersons ${OLD_PEOPLE_LEADER} ${PORT} ${0}
81 Should Be Equal As Strings ${resp.status_code} 200
82 :FOR ${i} IN RANGE 1 ${NUM_ENTRIES}
83 \ Should Contain ${resp.content} user${i}