Merge "Use constants for magic numbers in perf tests"
[cps.git] / integration-test / src / test / groovy / org / onap / cps / integration / performance / base / CpsPerfTestBase.groovy
index 6b1efe9..8a3bd6d 100644 (file)
@@ -26,7 +26,10 @@ import org.springframework.web.multipart.MultipartFile
 
 class CpsPerfTestBase extends PerfTestBase {
 
-    static def CPS_PERFORMANCE_TEST_DATASPACE = 'cpsPerformanceDataspace'
+    static final def CPS_PERFORMANCE_TEST_DATASPACE = 'cpsPerformanceDataspace'
+    static final def OPENROADM_ANCHORS = 5
+    static final def OPENROADM_DEVICES_PER_ANCHOR = 50
+    static final def OPENROADM_DATANODES_PER_DEVICE = 86
 
     def printTitle() {
         println('##        C P S   P E R F O R M A N C E   T E S T   R E S U L T S          ##')
@@ -64,7 +67,7 @@ class CpsPerfTestBase extends PerfTestBase {
         addAnchorsWithData(5, CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'bookstore', data)
         stopWatch.stop()
         def durationInMillis = stopWatch.getTotalTimeMillis()
-        recordAndAssertPerformance('Creating bookstore anchors with large data tree', 3_000, durationInMillis)
+        recordAndAssertPerformance('Creating bookstore anchors with large data tree', 1_500, durationInMillis)
     }
 
     def addOpenRoadModel() {
@@ -76,12 +79,12 @@ class CpsPerfTestBase extends PerfTestBase {
     }
 
     def addOpenRoadData() {
-        def data = generateOpenRoadData(50)
+        def data = generateOpenRoadData(OPENROADM_DEVICES_PER_ANCHOR)
         stopWatch.start()
-        addAnchorsWithData(5, CPS_PERFORMANCE_TEST_DATASPACE, LARGE_SCHEMA_SET, 'openroadm', data)
+        addAnchorsWithData(OPENROADM_ANCHORS, CPS_PERFORMANCE_TEST_DATASPACE, LARGE_SCHEMA_SET, 'openroadm', data)
         stopWatch.stop()
         def durationInMillis = stopWatch.getTotalTimeMillis()
-        recordAndAssertPerformance('Creating openroadm anchors with large data tree', 30_000, durationInMillis)
+        recordAndAssertPerformance('Creating openroadm anchors with large data tree', 20_000, durationInMillis)
     }
 
     def generateOpenRoadData(numberOfNodes) {
@@ -98,8 +101,8 @@ class CpsPerfTestBase extends PerfTestBase {
             assert countDataNodesInTree(result) == 1
             stopWatch.stop()
             def durationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'all data is read within 30 seconds (warm up not critical)'
-            recordAndAssertPerformance("Warming database", 30_000, durationInMillis)
+        then: 'all data is read within 20 seconds'
+            recordAndAssertPerformance("Warming database", 20_000, durationInMillis)
     }
 
 }