From 6d3b8b371dde27bd3b295112491f4dff97723698 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Thu, 5 Jan 2023 11:03:17 +0000 Subject: [PATCH] Add delete performance tests Issue-ID: CPS-1437 Signed-off-by: danielhanrahan Change-Id: If940d7633ab6f85b6e1e311af7077ce2006cfa6a --- ...vy => CpsDataPersistenceServicePerfTest.groovy} | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) rename cps-ri/src/test/groovy/org/onap/cps/spi/performance/{CpsToDataNodePerfTest.groovy => CpsDataPersistenceServicePerfTest.groovy} (78%) diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsToDataNodePerfTest.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy similarity index 78% rename from cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsToDataNodePerfTest.groovy rename to cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy index 265c5fc5fd..910d8a4601 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsToDataNodePerfTest.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy @@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS -class CpsToDataNodePerfTest extends CpsPersistenceSpecBase { +class CpsDataPersistenceServicePerfTest extends CpsPersistenceSpecBase { static final String PERF_TEST_DATA = '/data/perf-test.sql' @@ -104,6 +104,42 @@ class CpsToDataNodePerfTest extends CpsPersistenceSpecBase { 'include descendants (although there are none)' | INCLUDE_ALL_DESCENDANTS || 150 } + def 'Delete 50 grandchildren (that have no descendants)'() { + when: 'target nodes are deleted' + stopWatch.start() + (1..50).each { + def grandchildPath = "${PERF_TEST_PARENT}/perf-test-child-1/perf-test-grand-child-${it}".toString(); + objectUnderTest.deleteDataNode('PERF-DATASPACE', 'PERF-ANCHOR', grandchildPath) + } + stopWatch.stop() + def deleteDurationInMillis = stopWatch.getTotalTimeMillis() + then: 'delete duration is under 1000 milliseconds' + assert deleteDurationInMillis < 1000 + } + + def 'Delete 5 children with grandchildren'() { + when: 'child nodes are deleted' + stopWatch.start() + (1..5).each { + def childPath = "${PERF_TEST_PARENT}/perf-test-child-${it}".toString(); + objectUnderTest.deleteDataNode('PERF-DATASPACE', 'PERF-ANCHOR', childPath) + } + stopWatch.stop() + def deleteDurationInMillis = stopWatch.getTotalTimeMillis() + then: 'delete duration is under 10000 milliseconds' + assert deleteDurationInMillis < 10000 + } + + def 'Delete 1 large data node with many descendants'() { + when: 'parent node is deleted' + stopWatch.start() + objectUnderTest.deleteDataNode('PERF-DATASPACE', 'PERF-ANCHOR', PERF_TEST_PARENT) + stopWatch.stop() + def deleteDurationInMillis = stopWatch.getTotalTimeMillis() + then: 'delete duration is under 5000 milliseconds' + assert deleteDurationInMillis < 5000 + } + def createLineage() { (1..NUMBER_OF_CHILDREN).each { def childName = "perf-test-child-${it}".toString() -- 2.16.6