diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2023-04-13 18:53:59 +0100 |
---|---|---|
committer | Daniel Hanrahan <daniel.hanrahan@est.tech> | 2023-04-14 16:17:10 +0000 |
commit | 375f84708e981d5943d170913dec08d3365a0b1f (patch) | |
tree | 5fa6715bc6ba91fd8be4665354e75e350ca19439 /integration-test | |
parent | c4621cbcb1f9aad97ba3389468546444d1e9f3dc (diff) |
Add tests for 32K limit for collection parameters
SQL queries taking collection parameters currently create a seperate
query parameter for each collection element. There is a limit of
around 2^15 (32,768) query parameters.
- Add tests for cps-service methods exceeding the collection size limit
Issue-ID: CPS-1573
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I7169b3604f4dd0bb23bba8ff33f0102c43052c03
Diffstat (limited to 'integration-test')
3 files changed, 113 insertions, 10 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy new file mode 100644 index 0000000000..2c7c6ce35c --- /dev/null +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimits.groovy @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.integration.performance.cps + +import org.onap.cps.integration.performance.base.CpsPerfTestBase +import org.springframework.dao.DataAccessResourceFailureException + +class CpsAdminServiceLimits extends CpsPerfTestBase { + + def objectUnderTest + + def setup() { objectUnderTest = cpsAdminService } + + def 'Get anchors from multiple schema set names limit exceeded: 32,766 (~ 2^15) schema set names.'() { + given: 'more than 32,766 schema set names' + def schemaSetNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it } + when: 'single get is executed to get all the anchors' + objectUnderTest.getAnchors(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetNames) + then: 'a database exception is thrown' + thrown(DataAccessResourceFailureException.class) + } + + def 'Querying anchor names limit exceeded: 32,766 (~ 2^15) modules.'() { + given: 'more than 32,766 module names' + def moduleNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it } + when: 'single query is executed to get all the anchors' + objectUnderTest.queryAnchorNames(CPS_PERFORMANCE_TEST_DATASPACE, moduleNames) + then: 'a database exception is thrown' + thrown(DataAccessResourceFailureException.class) + } + +} diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy new file mode 100644 index 0000000000..1cb4ed800c --- /dev/null +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimits.groovy @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.integration.performance.cps + +import java.time.OffsetDateTime +import org.onap.cps.integration.performance.base.CpsPerfTestBase +import org.springframework.dao.DataAccessResourceFailureException +import org.springframework.transaction.TransactionSystemException + +import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS + +class CpsDataServiceLimits extends CpsPerfTestBase { + + def objectUnderTest + + def setup() { objectUnderTest = cpsDataService } + + def 'Multiple get limit exceeded: 32,764 (~ 2^15) xpaths.'() { + given: 'more than 32,764 xpaths' + def xpaths = (0..32_764).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 thrown' + thrown(DataAccessResourceFailureException.class) + } + + def 'Delete multiple datanodes limit exceeded: 32,767 (~ 2^15) xpaths.'() { + given: 'more than 32,767 xpaths' + def xpaths = (0..32_767).collect { "/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']" } + when: 'single operation is executed to delete all datanodes with given xpaths' + objectUnderTest.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'bookstore1', xpaths, OffsetDateTime.now()) + then: 'a database exception is thrown' + thrown(TransactionSystemException.class) + } + + def 'Delete datanodes from multiple anchors limit exceeded: 32,766 (~ 2^15) anchors.'() { + given: 'more than 32,766 anchor names' + def anchorNames = (0..32_766).collect { "size-of-this-name-does-not-matter-for-limit-" + it } + when: 'single operation is executed to delete all datanodes in given anchors' + objectUnderTest.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, anchorNames, OffsetDateTime.now()) + then: 'a database exception is thrown' + thrown(DataAccessResourceFailureException.class) + } + +} 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 4edc1d72ad..4676c908b9 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 @@ -21,7 +21,6 @@ package org.onap.cps.integration.performance.cps import org.onap.cps.integration.performance.base.CpsPerfTestBase -import org.springframework.dao.DataAccessResourceFailureException import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS @@ -81,13 +80,4 @@ class GetPerfTest extends CpsPerfTestBase { 'openroadm top element' | 'openroadm' | '/openroadm-devices' || 1000 | 1 + 50 * 86 } - def 'Multiple get limit exceeded: 32,764 (~ 2^15) xpaths.'() { - given: 'more than 32,764 xpaths)' - def xpaths = (0..32_764).collect { "/size/of/this/path/does/not/matter/for/limit[@id='" + it + "']" } - when: 'single get is executed to get all the parent objects and their descendants' - cpsDataService.getDataNodesForMultipleXpaths(CPS_PERFORMANCE_TEST_DATASPACE, 'bookstore1', xpaths, INCLUDE_ALL_DESCENDANTS) - then: 'an exception is thrown' - thrown(DataAccessResourceFailureException.class) - } - } |