From 92941fc5db6059dea26204c9f42a7b8cb9bb4416 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 26 Jul 2023 13:19:50 +0100 Subject: Improve 32K limit tests Some operations were previously limited to 32,768 parameters, such as getDataNodesForMultipleXpaths. After this limit was lifted, the tests only verified that database exceptions were not thrown. This commit improves the tests by verifying that the operations return or delete the expected data. - Create 33,000 data nodes - Verify that getDataNodesForMultipleXpaths returns 33,000 nodes - Verify than deleteDataNodes deletes 33,000 nodes Issue-ID: CPS-1811 Signed-off-by: danielhanrahan Change-Id: I7029ea0cf1d4e95c5ca814ca62c222fc5b9ddc7e --- .../cps/CpsDataServiceLimitsPerfTest.groovy | 76 ++++++++++++++++------ 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'integration-test/src/test') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy index e0df2fee77..9cb65ab8fd 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy @@ -23,9 +23,9 @@ package org.onap.cps.integration.performance.cps import java.time.OffsetDateTime import org.onap.cps.api.CpsDataService import org.onap.cps.integration.performance.base.CpsPerfTestBase -import org.onap.cps.spi.exceptions.DataNodeNotFoundException -import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS +import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY +import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase { @@ -33,31 +33,67 @@ class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase { def setup() { objectUnderTest = cpsDataService } - def 'Multiple get limit exceeded: 32,764 (~ 2^15) xpaths.'() { - given: 'more than 32,764 xpaths' - def xpaths = (0..40_000).collect { "/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']" } - when: 'single operation is executed to get all datanodes with given xpaths' - objectUnderTest.getDataNodesForMultipleXpaths(CPS_PERFORMANCE_TEST_DATASPACE, 'bookstore1', xpaths, INCLUDE_ALL_DESCENDANTS) - then: 'a database exception is not thrown' - noExceptionThrown() + def 'Create 33,000 books (note further tests depend on this running first).'() { + given: 'an anchor containing a bookstore with one category' + cpsAdminService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'limitsAnchor') + def parentNodeData = '{"bookstore": { "categories": [{ "code": 1, "name": "Test", "books" : [] }] }}' + cpsDataService.saveData(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor', parentNodeData, OffsetDateTime.now()) + when: '33,000 books are added' + stopWatch.start() + for (int i = 1; i <= 33_000; i+=100) { + def booksData = '{"books":[' + (i..