From 05e70c0df46d6e1a8ce77f02d03be8ae3657380f Mon Sep 17 00:00:00 2001 From: Harman Singh Date: Wed, 10 Sep 2014 21:45:11 -0700 Subject: [PATCH] Adding Longevity Test for clustering data store Usage example : pybot -v IP1:10.195.128.18 -v PORT:8181 -v IP2:10.195.128.35 -v IP3:10.195.128.19 -v DURATION:500 010__longevity.txt Change-Id: I1d40e366bb59b14822dd6fa17a42146c700684ac Signed-off-by: Harman Singh --- test/csit/libraries/CrudLibrary.py | 61 +++++++++++++++++++ .../datastore/longevity/010__longevity.txt | 11 ++++ .../datastore/longevity/__init__.txt | 10 +++ 3 files changed, 82 insertions(+) create mode 100644 test/csit/suites/clustering/datastore/longevity/010__longevity.txt create mode 100644 test/csit/suites/clustering/datastore/longevity/__init__.txt diff --git a/test/csit/libraries/CrudLibrary.py b/test/csit/libraries/CrudLibrary.py index 8e371e2024..f1a23d6fa0 100644 --- a/test/csit/libraries/CrudLibrary.py +++ b/test/csit/libraries/CrudLibrary.py @@ -5,6 +5,7 @@ __email__ = "syedbahm@cisco.com" import sys import UtilLibrary import SettingsLibrary +import time # #Creates the specified number of cars based on Cars yang model @@ -205,6 +206,66 @@ def deleteAllCarsPersons(hostname,port,ignore): resp = getPersons(hostname,port,ignore) print("Persons in store after deletion:"+ str(resp)) +# +# Write longevity +# +def testlongevity(inputtime,port,*ips): + max_time = int(inputtime) + start_time = time.time() # remember when we started + while (time.time() - start_time) < max_time: + for ip in ips: + deleteAllCars(ip,port,0) + resp = getCars(ip,port,0) + if resp.status_code == 404: + print("Pass: no cars found after deletion") + else: + print("Fail: Cars are present after deletion") + deleteAllPersons(ip,port,0) + resp = getPersons(ip,port,0) + if resp.status_code == 404: + print("Pass: no person found after deletion") + else: + print("Fail: people are present after deletion") + + addCar(ip,port,100) + time.sleep(20) + resp = getCars(ip,port,0) + if resp.status_code == 200: + print("Pass: car data available after addition") + if resp.content.find("manufacturer100") == -1: + print("Fail: last car is not there") + else: + print("Pass: car data matches") + else: + print("Fail: car addition failed") + addPerson(ip,port,0) + addPerson(ip,port,100) + time.sleep(20) + resp = getPersons(ip,port,0) + if resp.status_code == 200: + print("Pass: people data available after addition") + if resp.content.find("user100") == -1: + print("Fail: last person is not there") + else: + print("Pass: person data matches") + else: + print("Fail: person addition failed") + + addCarPerson(ip,port,0) + buyCar(ip,port,100) + time.sleep(20) + resp = getCarPersonMappings(ip,port,0) + if resp.status_code == 200: + print("Pass: car person data available after addition") + if resp.content.find("user100") == -1: + print("Fail: last car person is not there") + else: + print("Pass: car person data matches") + else: + print("Fail: car person addition failed") + time.sleep(60) # sleep before next host starts working + + # # Usage message shown to user # diff --git a/test/csit/suites/clustering/datastore/longevity/010__longevity.txt b/test/csit/suites/clustering/datastore/longevity/010__longevity.txt new file mode 100644 index 0000000000..3e6230b147 --- /dev/null +++ b/test/csit/suites/clustering/datastore/longevity/010__longevity.txt @@ -0,0 +1,11 @@ +*** Settings *** +Documentation Test suite for Longevity test of cluster datastore +Library ../../../../libraries/CrudLibrary.py + +*** Variables *** + + +*** Test Cases *** +Run Tests in Loop for Specified Time + [Documentation] Run CRUD operation from nodes for specified time + Testlongevity ${DURATION} ${PORT} ${IP1} ${IP2} ${IP3} diff --git a/test/csit/suites/clustering/datastore/longevity/__init__.txt b/test/csit/suites/clustering/datastore/longevity/__init__.txt new file mode 100644 index 0000000000..a26accedac --- /dev/null +++ b/test/csit/suites/clustering/datastore/longevity/__init__.txt @@ -0,0 +1,10 @@ +*** Settings *** +Documentation Test suite for Longevity test of cluster datastore +Suite Setup Start Suite +Suite Teardown Stop Suite +Library SSHLibrary + + +** Keywords *** +Start Suite +Stop Suite -- 2.36.6