Add resiliency to 3-node cluster tests
[integration/test.git] / test / csit / libraries / CrudLibrary.py
index 62fd4d5a60f26cf55e3b27cabe1d3f250d714587..1d8d54999fc78dcac682c6515cd1f42181ec6a69 100644 (file)
@@ -119,23 +119,23 @@ def addCarPerson(hostname,port,numberOfCarPersons):
 # </note>
 #
 
-def buyCar(hostname,port,numberOfCarBuyers):
-    for x in range(1, numberOfCarBuyers+1):
-        strId = str(x)
+def buyCar(hostname,port,numberOfCarBuyers,start=0):
+    for x in range(start, start+numberOfCarBuyers):
+        strId = str(x+1)
 
         payload = SettingsLibrary.buy_car_rpc_template.substitute(personId="user"+strId,carId=strId)
 
         # Send the POST request using RPC
         resp = UtilLibrary.post(SettingsLibrary.getBuyCarRpcUrl(hostname,port),"admin", "admin",payload)
 
-        print("payload formed after template substitution=")
-        print(payload)
-
-        print("the response of the POST to buycar=")
         print(resp)
+        print(resp.text)
+        
+        if (resp.status_code != 204):
+            return False
 
-    print("getting the car_persons for verification")
-    resp=getCarPersonMappings(hostname,port,0)
+
+    return True
 
 
 #