Adding Longevity Test for clustering data store 23/11023/2
authorHarman Singh <harmasin@cisco.com>
Thu, 11 Sep 2014 04:45:11 +0000 (21:45 -0700)
committerChristopher O'Shea <christopher.o.shea@ericsson.com>
Fri, 10 Oct 2014 18:29:32 +0000 (18:29 +0000)
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 <harmasin@cisco.com>
test/csit/libraries/CrudLibrary.py
test/csit/suites/clustering/datastore/longevity/010__longevity.txt [new file with mode: 0644]
test/csit/suites/clustering/datastore/longevity/__init__.txt [new file with mode: 0644]

index 8e371e20243ddee1280d2e42f887bfcd1cd8a497..f1a23d6fa0ee3cd65b063c24599f0ea60d730a56 100644 (file)
@@ -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 (file)
index 0000000..3e6230b
--- /dev/null
@@ -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 (file)
index 0000000..a26acce
--- /dev/null
@@ -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