Clear all data from shards before running test.
Find the leader and followers rather than assume the first controller
is leader.
Do a better job of verifying shard contents.
Because test 23 is a subset of test 24, both tests were combined as
test 23 and then test 24 was eliminated.
Change-Id: I63621efe814b7ab95d8990275ef14f4354698894
Signed-off-by: Phillip Shea <phillip.shea@hp.com>
*** Settings ***
Resource Utils.robot
Library Collections
+Library ClusterStateLibrary.py
*** Variables ***
*** Keywords ***
Get Controller List
[Arguments] ${exclude_controller}=${EMPTY}
- [Documentation] Creates a list of all controllers minus any excluded controller.
+ [Documentation] Creates a list of all controllers minus any excluded controller.
Log ${exclude_controller}
@{searchlist} Create List ${CONTROLLER} ${CONTROLLER1} ${CONTROLLER2}
Remove Values From List ${searchlist} ${exclude_controller}
: FOR ${ip} IN @{controllers}
\ Run Command On Remote System ${ip} ${cmd}
: FOR ${ip} IN @{controllers}
- \ Wait Until Keyword Succeeds 120 s 3 s Controller Down Check ${ip}
+ \ Wait Until Keyword Succeeds 120 s 3 s Controller Down Check ${ip}
Start One Or More Controllers
[Arguments] @{controllers}
${cmd} = Set Variable cat ${KARAF_HOME}/etc/org.apache.karaf.features.cfg
: FOR ${ip} IN @{controllers}
\ Run Command On Remote System ${ip} ${cmd}
+
+Check Cars
+ [Arguments] ${selected controller} ${PORT} ${nth car}
+ [Documentation] Verifies that the first through nth car is present.
+ ${resp} Getcars ${selected controller} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ : FOR ${INDEX} IN RANGE 1 ${nth car}
+ \ ${counter}= Convert to String ${INDEX}
+ \ Log manufacturer${counter}
+ \ Should Contain ${resp.content} manufacturer${counter}
+
+Check People
+ [Arguments] ${selected controller} ${PORT} ${nth person}
+ [Documentation] Verifies that the first through nth person is present.
+ ${resp} GetPersons ${selected controller} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ : FOR ${INDEX} IN RANGE 1 ${nth person}
+ \ ${counter}= Convert to String ${INDEX}
+ \ Log user${counter}
+ \ Should Contain ${resp.content} user${counter}
+
+Check CarPeople
+ [Arguments] ${selected controller} ${PORT} ${nth carperson}
+ [Documentation] Verifies that the first through nth car-person is present.
+ ${resp} GetCarPersonMappings ${selected controller} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ : FOR ${INDEX} IN RANGE 1 ${nth carperson}
+ \ ${counter}= Convert to String ${INDEX}
+ \ Log user${counter}
+ \ Should Contain ${resp.content} user${counter}
# Send the POST request REST CONF
resp = UtilLibrary.nonprintpost(SettingsLibrary.getAddCarPersonUrl(hostname, port), "admin", "admin", payload)
- return
+ return resp
for x in range(1, numberOfCarPersons+1):
strId = str(x)
print("getting the car_persons for verification")
resp = getCarPersonMappings(hostname, port, 0)
-
# TBD detailed validation
+ return resp
def buyCar(hostname, port, numberOfCarBuyers, start=0):
*** Settings ***
Documentation Start the controllers
Default Tags 3-node-cluster
-Resource ../../../libraries/Utils.robot
+Resource ../../../libraries/ClusterKeywords.robot
*** Variables ***
@{controllers} ${CONTROLLER} ${CONTROLLER1} ${CONTROLLER2}
Library ../../../libraries/CrudLibrary.py
Library ../../../libraries/SettingsLibrary.py
Library ../../../libraries/UtilLibrary.py
+Resource ../../../libraries/ClusterKeywords.robot
Variables ../../../variables/Variables.py
*** Variables ***
@{controllers} ${CONTROLLER} ${CONTROLLER1} ${CONTROLLER2}
+${SHARD_CAR_NAME} shard-car-config
+${SHARD_PEOPLE_NAME} shard-people-config
+${SHARD_CAR_PERSON_NAME} shard-car-people-config
+${KARAF_HOME} ${WORKSPACE}/${BUNDLEFOLDER}
*** Test Cases ***
+Delete all entries from shards
+ [Documentation] Make sure the shards are cleared for testing.
+ : FOR ${ip} IN @{controllers}
+ \ Delete All Cars And Verify ${ip}
+ : FOR ${ip} IN @{controllers}
+ \ Delete All People And Verify ${ip}
+ : FOR ${ip} IN @{controllers}
+ \ Delete All Cars-Persons And Verify ${ip}
+
+Get Car Leader And Followers
+ ${CURRENT_CAR_LEADER} Wait For Leader To Be Found ${SHARD_CAR_NAME}
+ Set Suite Variable ${CURRENT_CAR_LEADER}
+ @{CAR_FOLLOWERS} Get All Followers ${SHARD_CAR_NAME}
+ Set Suite Variable ${CAR_FOLLOWERS}
+
Add cars and get cars from Leader
[Documentation] Add 100 cars and get added cars from Leader
- ${resp} InitCar ${CONTROLLER} ${PORT}
- ${resp} AddCar ${CONTROLLER} ${PORT} ${100}
- ${resp} Getcars ${CONTROLLER} ${PORT} ${0}
+ ${resp}= InitCar ${CURRENT_CAR_LEADER} ${PORT}
+ ${resp}= AddCar ${CURRENT_CAR_LEADER} ${PORT} ${100}
+ ${resp}= Getcars ${CURRENT_CAR_LEADER} ${PORT} ${0}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} manufacturer1 cars not added!
Add persons and get persons from Leader
[Documentation] Add 100 persons and get persons Note: There should be one person added first to enable rpc
- ${resp} AddPerson ${CONTROLLER} ${PORT} ${0}
- ${resp} AddPerson ${CONTROLLER} ${PORT} ${100}
- ${resp} GetPersons ${CONTROLLER} ${PORT} ${0}
+ ${resp} AddPerson ${CURRENT_CAR_LEADER} ${PORT} ${0}
+ ${resp} AddPerson ${CURRENT_CAR_LEADER} ${PORT} ${100}
+ ${resp} GetPersons ${CURRENT_CAR_LEADER} ${PORT} ${0}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} user5 people not added!
Add car-person mapping and get car-person mapping from Follower1
[Documentation] Add car-person and get car-person from Leader Note: This is done to enable working of rpc
- ${resp} AddCarPerson ${CONTROLLER1} ${PORT} ${0}
- ${resp} GetCarPersonMappings ${CONTROLLER1} ${PORT} ${0}
+ Log @{CAR_FOLLOWERS}[0]
+ ${resp} AddCarPerson @{CAR_FOLLOWERS}[0] ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 204
+ ${resp} GetCarPersonMappings @{CAR_FOLLOWERS}[0] ${PORT} ${0}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} user0 car-person not initialized!
Purchase 100 cars using Follower1
[Documentation] Purchase 100 cars using Follower1
- ${resp} BuyCar ${CONTROLLER1} ${PORT} ${100}
- ${resp} GetCarPersonMappings ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
+ BuyCar @{CAR_FOLLOWERS}[0] ${PORT} ${100}
-Get Cars from Leader
- [Documentation] Get 100 using Leader
- ${resp} Getcars ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} manufacturer99
+Check Contents of Leader Shards
+ [Documentation] Check all content using Leader
+ wait until keyword succeeds 30 1 Check Cars ${CURRENT_CAR_LEADER} ${PORT} 100
+ wait until keyword succeeds 30 1 Check People ${CURRENT_CAR_LEADER} ${PORT} 100
+ wait until keyword succeeds 30 1 Check CarPeople ${CURRENT_CAR_LEADER} ${PORT} 100
+
+Check Contents of First Follower Shards
+ [Documentation] Check all content using first follower
+ wait until keyword succeeds 30 1 Check Cars @{CAR_FOLLOWERS}[0] ${PORT} 100
+ wait until keyword succeeds 30 1 Check People @{CAR_FOLLOWERS}[0] ${PORT} 100
+ wait until keyword succeeds 30 1 Check CarPeople @{CAR_FOLLOWERS}[0] ${PORT} 100
+
+Check Contents of Second Follower Shards
+ [Documentation] Check all content using second follower
+ wait until keyword succeeds 30 1 Check Cars @{CAR_FOLLOWERS}[1] ${PORT} 100
+ wait until keyword succeeds 30 1 Check People @{CAR_FOLLOWERS}[1] ${PORT} 100
+ wait until keyword succeeds 30 1 Check CarPeople @{CAR_FOLLOWERS}[1] ${PORT} 100
+
+Switch Car leader
+ [Documentation] Stop the leader to cause a new leader to be elected
+ ${OLD_CAR_LEADER}= Set Variable ${CURRENT_CAR_LEADER}
+ Set Suite Variable ${OLD_CAR_LEADER}
+ ${NEW_CAR_LEADER} Switch Leader ${SHARD_CAR_NAME} ${CURRENT_CAR_LEADER}
+ Set Suite Variable ${NEW_CAR_LEADER}
-Get persons from Leader
- [Documentation] Get 101 Persons from Leader
- ${resp} GetPersons ${CONTROLLER} ${PORT} ${0}
+Get New Car Follower
+ [Documentation] Find the new leader for the car shard.
+ @{CAR_FOLLOWERS} Get All Followers ${SHARD_CAR_NAME}
+ Set Suite Variable ${CAR_FOLLOWERS}
+ Log @{CAR_FOLLOWERS}[0]
+
+Overwrite cars and get cars from New Leader
+ [Documentation] Overwrite 100 cars and get added cars from Leader
+ ${resp}= AddCar ${NEW_CAR_LEADER} ${PORT} ${100}
+ ${resp}= Getcars ${NEW_CAR_LEADER} ${PORT} ${0}
Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100
+ Should Contain ${resp.content} manufacturer1 cars not added!
-Get car-person mappings using Leader
- [Documentation] Get 101 car-person mappings using Leader to see 100 entry
- ${resp} GetCarPersonMappings ${CONTROLLER} ${PORT} ${0}
+Overwrite persons and get persons from New Leader
+ [Documentation] Overwrite 100 persons and get persons Note: There should be one person added first to enable rpc
+ ${resp} AddPerson ${NEW_CAR_LEADER} ${PORT} ${100}
+ ${resp} GetPersons ${NEW_CAR_LEADER} ${PORT} ${0}
Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100
+ Should Contain ${resp.content} user5 people not added!
+
+RePurchase 100 cars using New Follower1
+ [Documentation] RePurchase 100 cars using Follower1
+ BuyCar @{CAR_FOLLOWERS}[0] ${PORT} ${100}
+
+Check Contents of New Leader Shards
+ [Documentation] Check all content using Leader
+ Log ${NEW_CAR_LEADER}
+ wait until keyword succeeds 30 1 Check Cars ${NEW_CAR_LEADER} ${PORT} 100
+ wait until keyword succeeds 30 1 Check People ${NEW_CAR_LEADER} ${PORT} 100
+ wait until keyword succeeds 30 1 Check CarPeople ${NEW_CAR_LEADER} ${PORT} 100
+
+Check Contents of New First Follower Shards
+ [Documentation] Check all content using first follower
+ wait until keyword succeeds 30 1 Check Cars @{CAR_FOLLOWERS}[0] ${PORT} 100
+ wait until keyword succeeds 30 1 Check People @{CAR_FOLLOWERS}[0] ${PORT} 100
+ wait until keyword succeeds 30 1 Check CarPeople @{CAR_FOLLOWERS}[0] ${PORT} 100
+
+Start Leader
+ [Documentation] Start Leader controller
+ Start One Or More Controllers ${OLD_CAR_LEADER}
+++ /dev/null
-*** Settings ***
-Documentation Test suite for Routed RPC.
-Resource ../../../libraries/Utils.robot
-Library Collections
-Library RequestsLibrary
-Library ../../../libraries/Common.py
-Library ../../../libraries/CrudLibrary.py
-Library ../../../libraries/SettingsLibrary.py
-Library ../../../libraries/UtilLibrary.py
-Library ../../../libraries/ClusterStateLibrary.py
-Variables ../../../variables/Variables.py
-
-*** Test Cases ***
-Add cars and get cars from Leader
- [Documentation] Add 100 cars and get added cars from Leader
- ${resp} InitCar ${CONTROLLER} ${PORT}
- ${resp} AddCar ${CONTROLLER} ${PORT} ${100}
- ${resp} Getcars ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} manufacturer1
-
-Add persons and get persons from Leader
- [Documentation] Add 100 persons and get persons Note: There should be one person added first to enable rpc
- ${resp} AddPerson ${CONTROLLER} ${PORT} ${0}
- ${resp} AddPerson ${CONTROLLER} ${PORT} ${100}
- ${resp} GetPersons ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user5
-
-Add car-person mapping and get car-person mapping from Follower1
- [Documentation] Add car-person and get car-person from Follower1 Note: This is done to enable working of rpc
- ${resp} AddCarPerson ${CONTROLLER1} ${PORT} ${0}
- ${resp} GetCarPersonMappings ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user0
-
-Purchase 100 cars using Follower
- [Documentation] Purchase 100 cars using Follower
- ${resp} BuyCar ${CONTROLLER1} ${PORT} ${100}
- ${resp} GetCarPersonMappings ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
-
-Get Cars from Leader
- [Documentation] Get 100 using Leader
- ${resp} Getcars ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} manufacturer9 cars not returned!
-
-Get persons from Leader
- [Documentation] Get 11 Persons from Leader
- ${resp} GetPersons ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100 people not returned!
-
-Get car-person mappings using Leader
- [Documentation] Get car-person mappings using Leader to see 100 entry
- ${resp} GetCarPersonMappings ${CONTROLLER} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100 car-people not returned!
-
-Stop Leader
- [Documentation] Stop Leader controller
- Stop One Or More Controllers ${CONTROLLER}
- Kill One Or More Controllers ${CONTROLLER}
-
-Add cars and get cars from Follower1
- [Documentation] Add 100 cars and get added cars from Follower
- ${resp} InitCar ${CONTROLLER1} ${PORT}
- ${resp} AddCar ${CONTROLLER1} ${PORT} ${100}
- ${resp} Getcars ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} manufacturer1 cars not added!
-
-Add persons and get persons from Follower1
- [Documentation] Add 100 persons and get persons Note: There should be one person added first to enable rpc
- ${resp} AddPerson ${CONTROLLER1} ${PORT} ${0}
- ${resp} AddPerson ${CONTROLLER1} ${PORT} ${100}
- ${resp} GetPersons ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user5 car-people not initialized!
-
-Purchase 100 cars using Follower2
- [Documentation] Purchase 100 cars using Follower2
- ${resp} BuyCar ${CONTROLLER2} ${PORT} ${100}
- ${resp} GetCarPersonMappings ${CONTROLLER2} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
-
-Get Cars from Follower1
- [Documentation] Get 100 using Follower1
- ${resp} Getcars ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} manufacturer9 cars not returned!
-
-Get persons from Follower1
- [Documentation] Get 11 Persons from Follower1
- ${resp} GetPersons ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100 people not returned!
-
-Get car-person mappings using Follower1
- [Documentation] Get car-person mappings using Follower1 to see 100 entry
- ${resp} GetCarPersonMappings ${CONTROLLER1} ${PORT} ${0}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} user100 car-people not returned!
-
-Start Leader
- [Documentation] Start Leader controller
- Start One Or More Controllers ${CONTROLLER}