From 2e4fbdf79514ecf1c6a5387d70045c498e325d8a Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Tue, 28 Mar 2023 16:43:10 +0100 Subject: Performance tests for getDataNodes and queryDataNodes - Generate openroadm data from a single innerNode.json template - Double the number of openroadm device nodes (25 -> 50) in tests - Add new performance tests for getDataNodes and queryDataNodes to integration-test module, using openroadm and bookstore data - Remove old performance tests from cps-ri Issue-ID: CPS-1524 Signed-off-by: danielhanrahan Change-Id: Id9ec2a86d984d6c50c9ae6093e7a62729cb851da --- .../CpsDataPersistenceServicePerfTest.groovy | 58 ---------------------- 1 file changed, 58 deletions(-) (limited to 'cps-ri') diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy index 7f1fb20f7..2628e9697 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy @@ -47,7 +47,6 @@ class CpsDataPersistenceServicePerfTest extends CpsPersistencePerfSpecBase { static def NUMBER_OF_CHILDREN = 200 static def NUMBER_OF_GRAND_CHILDREN = 50 - static def TOTAL_NUMBER_OF_NODES = 1 + NUMBER_OF_CHILDREN + (NUMBER_OF_CHILDREN * NUMBER_OF_GRAND_CHILDREN) // Parent + Children + Grand-children @Sql([CLEAR_DATA, PERF_TEST_DATA]) def 'Create a node with many descendants (please note, subsequent tests depend on this running first).'() { @@ -60,63 +59,6 @@ class CpsDataPersistenceServicePerfTest extends CpsPersistencePerfSpecBase { recordAndAssertPerformance('Setup', 10000, setupDurationInMillis) } - def 'Get data node with many descendants by xpath #scenario'() { - when: 'get parent is executed with all descendants' - stopWatch.start() - def result = objectUnderTest.getDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpath, INCLUDE_ALL_DESCENDANTS) - stopWatch.stop() - def readDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'read duration is under #allowedDuration milliseconds' - recordAndAssertPerformance("Get ${scenario}", allowedDuration, readDurationInMillis) - and: 'data node is returned with all the descendants populated' - assert countDataNodes(result[0]) == TOTAL_NUMBER_OF_NODES - where: 'the following xPaths are used' - scenario | xpath || allowedDuration - 'parent' | PERF_TEST_PARENT || 500 - 'root' | '/' || 500 - } - - def 'Query parent data node with many descendants by cps-path'() { - when: 'query is executed with all descendants' - stopWatch.start() - def result = objectUnderTest.queryDataNodes(PERF_DATASPACE, PERF_ANCHOR, '//perf-parent-1' , INCLUDE_ALL_DESCENDANTS) - stopWatch.stop() - def readDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'read duration is under 350 milliseconds' - recordAndAssertPerformance('Query with many descendants', 350, readDurationInMillis) - and: 'data node is returned with all the descendants populated' - assert countDataNodes(result) == TOTAL_NUMBER_OF_NODES - } - - def 'Performance of finding multiple xpaths'() { - when: 'we query for all grandchildren (except 1 for fun) with the new native method' - xpathsToAllGrandChildren.remove(0) - stopWatch.start() - def result = objectUnderTest.getDataNodesForMultipleXpaths(PERF_DATASPACE, PERF_ANCHOR, xpathsToAllGrandChildren, INCLUDE_ALL_DESCENDANTS) - stopWatch.stop() - def readDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'the returned number of entities equal to the number of children * number of grandchildren' - assert result.size() == xpathsToAllGrandChildren.size() - and: 'it took less then 1000ms' - recordAndAssertPerformance('Find multiple xpaths', 1000, readDurationInMillis) - } - - def 'Query many descendants by cps-path with #scenario'() { - when: 'query is executed with all descendants' - stopWatch.start() - def result = objectUnderTest.queryDataNodes(PERF_DATASPACE, PERF_ANCHOR, '//perf-test-grand-child-1', descendantsOption) - stopWatch.stop() - def readDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'read duration is under #allowedDuration milliseconds' - recordAndAssertPerformance("Query many descendants by cpspath (${scenario})", allowedDuration, readDurationInMillis) - and: 'data node is returned with all the descendants populated' - assert result.size() == NUMBER_OF_CHILDREN - where: 'the following options are used' - scenario | descendantsOption || allowedDuration - 'omit descendants ' | OMIT_DESCENDANTS || 150 - 'include descendants (although there are none)' | INCLUDE_ALL_DESCENDANTS || 150 - } - def 'Update data nodes with descendants'() { given: 'a list of xpaths to data nodes with descendants (xpath for each child)' def xpaths = (1..20).collect { -- cgit 1.2.3-korg