From: Toine Siebelink Date: Fri, 16 Dec 2022 09:15:34 +0000 (+0000) Subject: Merge "CPS-341 Support for multiple data tree instances under 1 anchor" X-Git-Tag: 3.2.1~41 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=eb56f6192d3cccaad1f43df1a4898a3d9d1e8819;hp=0c8068aadbb34f30ca58efb9a860b2d88016627a;p=cps.git Merge "CPS-341 Support for multiple data tree instances under 1 anchor" --- diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml index 5bdf793fc..fb0638ea3 100755 --- a/cps-dependencies/pom.xml +++ b/cps-dependencies/pom.xml @@ -207,6 +207,11 @@ hazelcast-spring 4.2.5 + + com.google.guava + guava + 31.1-jre + diff --git a/cps-ncmp-rest-stub/pom.xml b/cps-ncmp-rest-stub/pom.xml index 93c73fcb5..35784fb25 100644 --- a/cps-ncmp-rest-stub/pom.xml +++ b/cps-ncmp-rest-stub/pom.xml @@ -91,11 +91,6 @@ slf4j-simple 1.8.0-beta4 - - com.google.guava - guava - 20.0 - cglib cglib-nodep diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index d3fe0f357..b8408f802 100755 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -39,7 +39,7 @@ org.onap.cps.Application 11 0.97 - 42.5.0 + 42.5.1 ${project.reporting.outputDirectory}/jacoco-aggregate 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/CpsToDataNodePerfTest.groovy index 387fc1f85..b26cef4de 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/CpsToDataNodePerfTest.groovy @@ -27,7 +27,11 @@ import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.DataNodeBuilder import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.jdbc.Sql + +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 { @@ -36,66 +40,85 @@ class CpsToDataNodePerfTest extends CpsPersistenceSpecBase { @Autowired CpsDataPersistenceService objectUnderTest - def PERF_TEST_PARENT = '/perf-parent-1' + static def PERF_TEST_PARENT = '/perf-parent-1' + 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 + static def ALLOWED_SETUP_TIME_MS = TimeUnit.SECONDS.toMillis(10) + static def ALLOWED_READ_TIME_AL_NODES_MS = 500 - def EXPECTED_NUMBER_OF_NODES = 10051 // 1 Parent + 50 Children + 10000 Grand-children + def readStopWatch = new StopWatch() @Sql([CLEAR_DATA, PERF_TEST_DATA]) - def 'Get data node by xpath with all descendants with many children'() { - given: 'nodes and grandchildren have been persisted' + def 'Create a node with many descendants (please note, subsequent tests depend on this running first).'() { + given: 'a node with a large number of descendants is created' def setupStopWatch = new StopWatch() setupStopWatch.start() createLineage() setupStopWatch.stop() def setupDurationInMillis = setupStopWatch.getTime() - and: 'setup duration is under 10000 milliseconds' - assert setupDurationInMillis < 10000 + and: 'setup duration is under #ALLOWED_SETUP_TIME_MS milliseconds' + assert setupDurationInMillis < ALLOWED_SETUP_TIME_MS + } + + def 'Get data node with many descendants by xpath #scenario'() { when: 'get parent is executed with all descendants' - def readStopWatch = new StopWatch() readStopWatch.start() - def result = objectUnderTest.getDataNode('PERF-DATASPACE', 'PERF-ANCHOR', PERF_TEST_PARENT, INCLUDE_ALL_DESCENDANTS) + def result = objectUnderTest.getDataNode('PERF-DATASPACE', 'PERF-ANCHOR', xpath, INCLUDE_ALL_DESCENDANTS) readStopWatch.stop() def readDurationInMillis = readStopWatch.getTime() then: 'read duration is under 500 milliseconds' - assert readDurationInMillis < 500 + assert readDurationInMillis < ALLOWED_READ_TIME_AL_NODES_MS and: 'data node is returned with all the descendants populated' - assert countDataNodes(result) == EXPECTED_NUMBER_OF_NODES - when: 'get root is executed with all descendants' + assert countDataNodes(result) == TOTAL_NUMBER_OF_NODES + where: 'the following xPaths are used' + scenario || xpath + 'parent' || PERF_TEST_PARENT + 'root' || '' + } + + def 'Query parent data node with many descendants by cps-path'() { + when: 'query is executed with all descendants' readStopWatch.reset() readStopWatch.start() - result = objectUnderTest.getDataNode('PERF-DATASPACE', 'PERF-ANCHOR', '', INCLUDE_ALL_DESCENDANTS) + def result = objectUnderTest.queryDataNodes('PERF-DATASPACE', 'PERF-ANCHOR', '//perf-parent-1' , INCLUDE_ALL_DESCENDANTS) readStopWatch.stop() - readDurationInMillis = readStopWatch.getTime() + def readDurationInMillis = readStopWatch.getTime() then: 'read duration is under 500 milliseconds' - assert readDurationInMillis < 500 + assert readDurationInMillis < ALLOWED_READ_TIME_AL_NODES_MS and: 'data node is returned with all the descendants populated' - assert countDataNodes(result) == EXPECTED_NUMBER_OF_NODES + assert countDataNodes(result) == TOTAL_NUMBER_OF_NODES + } + + def 'Query many descendants by cps-path with #scenario'() { when: 'query is executed with all descendants' readStopWatch.reset() readStopWatch.start() - result = objectUnderTest.queryDataNodes('PERF-DATASPACE', 'PERF-ANCHOR', '//perf-parent-1', INCLUDE_ALL_DESCENDANTS) + def result = objectUnderTest.queryDataNodes('PERF-DATASPACE', 'PERF-ANCHOR', '//perf-test-grand-child-1', descendantsOption) readStopWatch.stop() - readDurationInMillis = readStopWatch.getTime() + def readDurationInMillis = readStopWatch.getTime() then: 'read duration is under 500 milliseconds' - assert readDurationInMillis < 500 + assert readDurationInMillis < alowedDuration and: 'data node is returned with all the descendants populated' - assert countDataNodes(result) == EXPECTED_NUMBER_OF_NODES + assert result.size() == NUMBER_OF_CHILDREN + where: 'the following options are used' + scenario | descendantsOption || alowedDuration + 'omit descendants ' | OMIT_DESCENDANTS || 150 + 'include descendants (although there are none)' | INCLUDE_ALL_DESCENDANTS || 1500 } def createLineage() { - def numOfChildren = 50 - def numOfGrandChildren = 200 - (1..numOfChildren).each { + (1..NUMBER_OF_CHILDREN).each { def childName = "perf-test-child-${it}".toString() - def newChild = goForthAndMultiply(PERF_TEST_PARENT, childName, numOfGrandChildren) + def newChild = goForthAndMultiply(PERF_TEST_PARENT, childName) objectUnderTest.addChildDataNode('PERF-DATASPACE', 'PERF-ANCHOR', PERF_TEST_PARENT, newChild) } } - def goForthAndMultiply(parentXpath, childName, numOfGrandChildren) { + def goForthAndMultiply(parentXpath, childName) { def children = [] - (1..numOfGrandChildren).each { - def child = new DataNodeBuilder().withXpath("${parentXpath}/${childName}/${it}perf-test-grand-child").build() + (1..NUMBER_OF_GRAND_CHILDREN).each { + def child = new DataNodeBuilder().withXpath("${parentXpath}/${childName}/perf-test-grand-child-${it}").build() children.add(child) } return new DataNodeBuilder().withXpath("${parentXpath}/${childName}").withChildDataNodes(children).build() diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh index 67412f3cf..dde961697 100755 --- a/csit/prepare-csit.sh +++ b/csit/prepare-csit.sh @@ -28,6 +28,21 @@ fi TESTPLANDIR=${WORKSPACE}/${TESTPLAN} +# Version should match those used to setup robot-framework in other jobs/stages +# Use pyenv for selecting the python version +if [[ -d "/opt/pyenv" ]]; then + echo "Setup pyenv:" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + pyenv versions + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init - --no-rehash)" + # Choose the latest numeric Python version from installed list + version=$(pyenv versions --bare | sed '/^[^0-9]/d' | sort -V | tail -n 1) + pyenv local "${version}" + fi +fi + # Assume that if ROBOT3_VENV is set and virtualenv with system site packages can be activated, # ci-management/jjb/integration/include-raw-integration-install-robotframework.sh has already # been executed @@ -48,7 +63,10 @@ fi # install eteutils mkdir -p ${ROBOT3_VENV}/src/onap rm -rf ${ROBOT3_VENV}/src/onap/testsuite -python3 -m pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre -pip freeze +python3 -m pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==11.0.0.dev17' --pre +echo "Versioning information:" +python3 --version +pip freeze +python3 -m robot.run --version || : \ No newline at end of file diff --git a/csit/run-csit.sh b/csit/run-csit.sh index 6703160a3..9a344c1ff 100755 --- a/csit/run-csit.sh +++ b/csit/run-csit.sh @@ -20,14 +20,29 @@ # Branched from ccsdk/distribution to this repository Feb 23, 2021 +echo "---> run-csit.sh" + WORKDIR=$(mktemp -d --suffix=-robot-workdir) +# Version should match those used to setup robot-framework in other jobs/stages +# Use pyenv for selecting the python version +if [[ -d "/opt/pyenv" ]]; then + echo "Setup pyenv:" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + pyenv versions + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init - --no-rehash)" + # Choose the latest numeric Python version from installed list + version=$(pyenv versions --bare | sed '/^[^0-9]/d' | sort -V | tail -n 1) + pyenv local "${version}" + fi +fi + # # functions # -echo "---> run-csit.sh" - # wrapper for sourcing a file function source_safely() { [ -z "$1" ] && return 1 @@ -192,6 +207,12 @@ SUITES=$( xargs -a testplan.txt ) echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" echo "Starting Robot test suites ${SUITES} ..." relax_set + +echo "Versioning information:" +python3 --version +pip freeze +python3 -m robot.run --version || : + python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} RESULT=$? load_set