diff options
-rwxr-xr-x | cps-dependencies/pom.xml | 5 | ||||
-rw-r--r-- | cps-ncmp-rest-stub/pom.xml | 5 | ||||
-rwxr-xr-x | cps-parent/pom.xml | 2 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsToDataNodePerfTest.groovy | 75 | ||||
-rwxr-xr-x | csit/prepare-csit.sh | 22 | ||||
-rwxr-xr-x | csit/run-csit.sh | 25 |
6 files changed, 98 insertions, 36 deletions
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 @@ <artifactId>hazelcast-spring</artifactId> <version>4.2.5</version> </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>31.1-jre</version> + </dependency> </dependencies> </dependencyManagement> </project> 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 @@ -92,11 +92,6 @@ <version>1.8.0-beta4</version> </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>20.0</version> - </dependency> - <dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <scope>test</scope> 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 @@ <app>org.onap.cps.Application</app> <java.version>11</java.version> <minimum-coverage>0.97</minimum-coverage> - <postgres.version>42.5.0</postgres.version> + <postgres.version>42.5.1</postgres.version> <jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate> <sonar.coverage.jacoco.xmlReportPaths> 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 |