summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/test/groovy
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-01-05 11:03:17 +0000
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-01-05 12:00:36 +0000
commit6d3b8b371dde27bd3b295112491f4dff97723698 (patch)
treeba5ce94954c797eac57309795687c87a009ad303 /cps-ri/src/test/groovy
parentf7745da81ea488e55f717f765cf85eff8968d9c3 (diff)
Add delete performance tests
Issue-ID: CPS-1437 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: If940d7633ab6f85b6e1e311af7077ce2006cfa6a
Diffstat (limited to 'cps-ri/src/test/groovy')
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServicePerfTest.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsToDataNodePerfTest.groovy)38
1 files changed, 37 insertions, 1 deletions
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
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()