aboutsummaryrefslogtreecommitdiffstats
path: root/integration-test
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-06-21 12:22:46 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2023-06-21 13:37:16 +0100
commit765de151f09345e96fac3e3254071718289b8359 (patch)
treed58803f585a89b559db50092ff8f0a47c31af8f0 /integration-test
parent4110a6b1d9de96b4f35cf696dc340d2419976cbb (diff)
Add performance tests for updateDataLeaves
Issue-ID: CPS-1675 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I4dcd2ff0d0f6c3acf7373357da0ef7217a691573
Diffstat (limited to 'integration-test')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy33
1 files changed, 31 insertions, 2 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy
index a02d21c41a..b3c8841270 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/UpdatePerfTest.groovy
@@ -27,6 +27,7 @@ import org.onap.cps.integration.performance.base.CpsPerfTestBase
class UpdatePerfTest extends CpsPerfTestBase {
CpsDataService objectUnderTest
+ def now = OffsetDateTime.now()
def setup() { objectUnderTest = cpsDataService }
@@ -36,7 +37,7 @@ class UpdatePerfTest extends CpsPerfTestBase {
def jsonData = readResourceDataFile('openroadm/innerNode.json').replace('NODE_ID_HERE', '10')
when: 'the fragment entities are updated by the data nodes'
stopWatch.start()
- objectUnderTest.updateDataNodeAndDescendants(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm1', parentNodeXpath, jsonData, OffsetDateTime.now())
+ objectUnderTest.updateDataNodeAndDescendants(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm1', parentNodeXpath, jsonData, now)
stopWatch.stop()
def updateDurationInMillis = stopWatch.getTotalTimeMillis()
then: 'update duration is under 1000 milliseconds'
@@ -52,11 +53,39 @@ class UpdatePerfTest extends CpsPerfTestBase {
]}
when: 'the fragment entities are updated by the data nodes'
stopWatch.start()
- objectUnderTest.updateDataNodesAndDescendants(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm2', nodesJsonData, OffsetDateTime.now())
+ objectUnderTest.updateDataNodesAndDescendants(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm2', nodesJsonData, now)
stopWatch.stop()
def updateDurationInMillis = stopWatch.getTotalTimeMillis()
then: 'update duration is under 5000 milliseconds'
recordAndAssertPerformance('Update 10 data nodes', 4000, updateDurationInMillis)
}
+ def 'Update leaves for 1 data node'() {
+ given: 'Updated json for openroadm data'
+ def jsonDataUpdated = "{'openroadm-device':{'device-id':'C201-7-1A-10','status':'fail','ne-state':'jeopardy'}}"
+ def jsonDataOriginal = "{'openroadm-device':{'device-id':'C201-7-1A-10','status':'success','ne-state':'inservice'}}"
+ when: 'update is performed for leaves'
+ stopWatch.start()
+ objectUnderTest.updateNodeLeaves(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm3', "/openroadm-devices", jsonDataUpdated, now)
+ objectUnderTest.updateNodeLeaves(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm3', "/openroadm-devices", jsonDataOriginal, now)
+ stopWatch.stop()
+ def updateDurationInMillis = stopWatch.getTotalTimeMillis()
+ then: 'update duration is under 750 milliseconds'
+ recordAndAssertPerformance('Update leaves for 1 data node', 750, updateDurationInMillis)
+ }
+
+ def 'Batch update leaves for 50 data nodes'() {
+ given: 'Updated json for openroadm data'
+ def jsonDataUpdated = "{'openroadm-device':[" + (1..50).collect { "{'device-id':'C201-7-1A-" + it + "','status':'fail','ne-state':'jeopardy'}" }.join(",") + "]}"
+ def jsonDataOriginal = "{'openroadm-device':[" + (1..50).collect { "{'device-id':'C201-7-1A-" + it + "','status':'success','ne-state':'inservice'}" }.join(",") + "]}"
+ when: 'update is performed for leaves'
+ stopWatch.start()
+ objectUnderTest.updateNodeLeaves(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm4', "/openroadm-devices", jsonDataUpdated, now)
+ objectUnderTest.updateNodeLeaves(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm4', "/openroadm-devices", jsonDataOriginal, now)
+ stopWatch.stop()
+ def updateDurationInMillis = stopWatch.getTotalTimeMillis()
+ then: 'update duration is under 3500 milliseconds'
+ recordAndAssertPerformance('Batch update leaves for 50 data nodes', 3500, updateDurationInMillis)
+ }
+
}