From 84f8fdd66082f1662f99121162fbc98f1a3df870 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Wed, 28 May 2025 09:00:19 +0100 Subject: [PATCH] Make Groovy Performance Test Stable #7 - 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 --- .../cps/integration/performance/cps/CpsModuleServicePerfTest.groovy | 6 +++--- .../org/onap/cps/integration/performance/cps/DeletePerfTest.groovy | 4 ++-- .../org/onap/cps/integration/performance/cps/GetPerfTest.groovy | 6 +++--- .../org/onap/cps/integration/performance/cps/QueryPerfTest.groovy | 2 +- .../org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy | 4 ++-- .../org/onap/cps/integration/performance/cps/WritePerfTest.groovy | 4 ++-- .../cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsModuleServicePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsModuleServicePerfTest.groovy index 9c0187d5b7..50bb677532 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsModuleServicePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsModuleServicePerfTest.groovy @@ -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() { diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy index ad98d309f4..c09ec30c13 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy @@ -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'() { diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy index 68c29b2203..e3e618cb21 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/GetPerfTest.groovy @@ -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.05 | 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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy index 625cc005bd..78a5460ac7 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy index c2b027d56d..c0b0934b7c 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy @@ -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 } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy index 642f3f3809..04d4b7e6c7 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy @@ -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 } } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy index 3216cc1eff..bcef49202c 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryPerfTest.groovy @@ -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.'() { -- 2.16.6