Make Groovy Performance Test Stable #7 67/140967/1
authorToineSiebelink <toine.siebelink@est.tech>
Wed, 28 May 2025 08:00:19 +0000 (09:00 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Wed, 28 May 2025 08:00:19 +0000 (09:00 +0100)
- Last tweaks (I hope)
- Changed assert of 1 (ungraphed) test to use resource meter so it can be graphed in future

Issue-ID: CPS-2743
Change-Id: Ie4d480331964cd69d3e119fbd4bb9fdeb1499631
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsModuleServicePerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy
integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy

index 9c0187d..50bb677 100644 (file)
@@ -59,16 +59,16 @@ class CpsModuleServicePerfTest extends CpsPerfTestBase {
         then: 'the schema set is persisted correctly'
             def result =  cpsModuleService.getSchemaSet(CPS_PERFORMANCE_TEST_DATASPACE, 'perfSchemaSet')
             result.moduleReferences.size() == 200
-        and: 'identification of new module resources is fast enough (1,000 executions less then 6,000 milliseconds)'
+        and: 'identification of new module resources is fast enough (100 executions less then 2,000 milliseconds)'
             def stopWatch = new StopWatch()
-            1000.times() {
+            100.times() {
                 def moduleReferencesToCheck = createModuleReferencesWithRandomMatchingExistingModuleReferences()
                 stopWatch.start()
                 def newModuleReferences = objectUnderTest.identifyNewModuleReferences(moduleReferencesToCheck)
                 stopWatch.stop()
                 assert newModuleReferences.size() > 0 && newModuleReferences.size() < 300
             }
-            assert stopWatch.getTotalTimeMillis() < 10_000
+            recordAndAssertResourceUsage('NCMP: Create large schema set', 2, stopWatch.getTotalTimeSeconds(), 3, 0)
     }
 
     def createModuleReferencesWithRandomMatchingExistingModuleReferences() {
index ad98d30..c09ec30 100644 (file)
@@ -129,7 +129,7 @@ class DeletePerfTest extends CpsPerfTestBase {
             resourceMeter.stop()
             def deleteDurationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'delete duration is below accepted margin (3x) of the expected average'
-            recordAndAssertResourceUsage('Batch delete 100 whole lists', 3.0, deleteDurationInSeconds, 3, resourceMeter.getTotalMemoryUsageInMB(), 4)
+            recordAndAssertResourceUsage('Batch delete 100 whole lists', 2.4, deleteDurationInSeconds, 3, resourceMeter.getTotalMemoryUsageInMB(), 4)
     }
 
     def 'Delete 1 large data node'() {
@@ -159,7 +159,7 @@ class DeletePerfTest extends CpsPerfTestBase {
             resourceMeter.stop()
             def deleteDurationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'delete duration is below accepted margin of the expected average'
-            recordAndAssertResourceUsage('Delete data nodes for anchor', 1.8, deleteDurationInSeconds, 1, resourceMeter.getTotalMemoryUsageInMB())
+            recordAndAssertResourceUsage('Delete data nodes for anchor', 1.9, deleteDurationInSeconds, 1, resourceMeter.getTotalMemoryUsageInMB())
     }
 
     def 'Batch delete 100 non-existing nodes'() {
index 68c29b2..e3e618c 100644 (file)
@@ -45,7 +45,7 @@ class GetPerfTest extends CpsPerfTestBase {
         where: 'the following parameters are used'
             scenario             | fetchDescendantsOption  || expectedDuration | memoryLimit | expectedNumberOfDataNodes
             'no descendants'     | OMIT_DESCENDANTS        || 0.01             | 1           | 1
-            'direct descendants' | DIRECT_CHILDREN_ONLY    || 0.0            | 5           | 1 + OPENROADM_DEVICES_PER_ANCHOR
+            'direct descendants' | DIRECT_CHILDREN_ONLY    || 0.045            | 5           | 1 + OPENROADM_DEVICES_PER_ANCHOR
             'all descendants'    | INCLUDE_ALL_DESCENDANTS || 1.1              | 250         | 1 + OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
     }
 
@@ -74,7 +74,7 @@ class GetPerfTest extends CpsPerfTestBase {
         then: 'no data is returned'
             assert result.isEmpty()
         and: 'the operation completes within within expected time'
-            recordAndAssertResourceUsage("Read non-existing xpaths", 0.15, durationInSeconds, 2, resourceMeter.getTotalMemoryUsageInMB())
+            recordAndAssertResourceUsage("Read non-existing xpaths", 0.06, durationInSeconds, 2, resourceMeter.getTotalMemoryUsageInMB())
     }
 
     def 'Read complete data trees using #scenario.'() {
@@ -89,7 +89,7 @@ class GetPerfTest extends CpsPerfTestBase {
         where: 'the following xpaths are used'
             scenario                | xpath                                  || expectedDuration | memoryLimit | expectedNumberOfDataNodes
             'openroadm root'        | '/'                                    || 1                | 250         | 1 + OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
-            'openroadm top element' | '/openroadm-devices'                   || 1.0              | 250         | 1 + OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
+            'openroadm top element' | '/openroadm-devices'                   || 0.95             | 250         | 1 + OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
             'openroadm whole list'  | '/openroadm-devices/openroadm-device'  || 1.06             | 250         | OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
     }
 
index 625cc00..78a5460 100644 (file)
@@ -82,7 +82,7 @@ class QueryPerfTest extends CpsPerfTestBase {
             recordAndAssertResourceUsage("Query with ${scenario}", expectedDuration, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB(),2)
         where: 'the following parameters are used'
             scenario             | fetchDescendantsOption  || expectedDuration | memoryLimit | expectedNumberOfDataNodes
-            'no descendants'     | OMIT_DESCENDANTS        || 0.08             | 6           | OPENROADM_DEVICES_PER_ANCHOR
+            'no descendants'     | OMIT_DESCENDANTS        || 0.09             | 6           | OPENROADM_DEVICES_PER_ANCHOR
             'direct descendants' | DIRECT_CHILDREN_ONLY    || 0.12             | 12          | OPENROADM_DEVICES_PER_ANCHOR * 2
             'all descendants'    | INCLUDE_ALL_DESCENDANTS || 1.05             | 200         | OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
     }
index c2b027d..c0b0934 100644 (file)
@@ -80,7 +80,7 @@ class UpdatePerfTest extends CpsPerfTestBase {
         where:
             scenario                           | totalNodes | startId | changeLeaves || expectedTime | memoryLimit
             'Replace 0 nodes with 100'         | 100        | 1       | false        || 3.0          | 200
-            'Replace 100 using same data'      | 100        | 1       | false        || 5.0          | 200
+            'Replace 100 using same data'      | 100        | 1       | false        || 5.5          | 200
             'Replace 100 with new leaf values' | 100        | 1       | true         || 5.4          | 200
             'Replace 100 with 100 new nodes'   | 100        | 101     | false        || 9.3          | 200
             'Replace 50 existing and 50 new'   | 100        | 151     | true         || 7.3          | 200
@@ -109,7 +109,7 @@ class UpdatePerfTest extends CpsPerfTestBase {
             'Replace list of 100 using same data'      | 100        | 1       | false        || 5.5          | 200
             'Replace list of 100 with new leaf values' | 100        | 1       | true         || 5.5          | 200
             'Replace list with 100 new nodes'          | 100        | 101     | false        || 9.0          | 200
-            'Replace list with 50 existing and 50 new' | 100        | 151     | true         || 7.0          | 200
+            'Replace list with 50 existing and 50 new' | 100        | 151     | true         || 8.0          | 200
             'Replace list of 100 nodes with 1'         | 1          | 1       | false        || 5.9          | 200
     }
 
index 642f3f3..04d4b7e 100644 (file)
@@ -98,8 +98,8 @@ class WritePerfTest extends CpsPerfTestBase {
             totalNodes || expectedDuration | memoryLimit
             50         || 1.5              | 100
             100        || 3.0              | 200
-            200        || 7.1              | 400
-            400        || 12.5             | 500
+            200        || 6.4              | 400
+            400        || 14.0             | 500
     }
 
 }
index 3216cc1..bcef492 100644 (file)
@@ -95,7 +95,7 @@ class CmHandleQueryPerfTest extends NcmpPerfTestBase {
         then: 'all alternate ids are resolved correctly'
             assert count == 100
         and: 'average performance is as expected'
-            recordAndAssertResourceUsage('Look up CM-handle by alternate-id', 1.4, resourceMeter.totalTimeInSeconds, 15, resourceMeter.totalMemoryUsageInMB)
+            recordAndAssertResourceUsage('Look up CM-handle by alternate-id', 1.75, resourceMeter.totalTimeInSeconds, 15, resourceMeter.totalMemoryUsageInMB)
     }
 
     def 'A batch of CM-handles is looked up by alternate id.'() {