Groovy performance test for attribute-axis 05/140405/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Fri, 7 Mar 2025 16:57:52 +0000 (16:57 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 11 Mar 2025 09:26:51 +0000 (09:26 +0000)
This adds a groovy performance for attribute-axis feature
(queryDataLeaf API).

Issue-ID: CPS-2635
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ib7fe324897a3a829cac3ced3446b4d007dc2bee4

integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/QueryPerfTest.groovy

index acc95ca..53e39ed 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2023 Nordix Foundation
+ *  Copyright (C) 2023-2025 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the 'License');
  *  you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ class QueryPerfTest extends CpsPerfTestBase {
             def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'the expected number of nodes is returned'
             assert countDataNodesInTree(result) == expectedNumberOfDataNodes
-        and: 'all data is read within #durationLimit ms  and memory used is within limit'
+        and: 'all data is read within #durationLimit seconds and memory used is within limit'
             recordAndAssertResourceUsage("Query 1 anchor ${scenario}", durationLimit, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
         where: 'the following parameters are used'
             scenario                     | cpsPath                                                             || durationLimit  | memoryLimit  | expectedNumberOfDataNodes
@@ -60,7 +60,7 @@ class QueryPerfTest extends CpsPerfTestBase {
             def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'the expected number of nodes is returned'
             assert countDataNodesInTree(result) == expectedNumberOfDataNodes
-        and: 'all data is read within #durationLimit ms and memory used is within limit'
+        and: 'all data is read within #durationLimit seconds and memory used is within limit'
             recordAndAssertResourceUsage("Query across anchors ${scenario}", durationLimit, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
         where: 'the following parameters are used'
             scenario                     | cpspath                                                             || durationLimit  | memoryLimit   | expectedNumberOfDataNodes
@@ -78,7 +78,7 @@ class QueryPerfTest extends CpsPerfTestBase {
             def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'the expected number of nodes is returned'
             assert countDataNodesInTree(result) == expectedNumberOfDataNodes
-        and: 'all data is read within #durationLimit ms and memory used is within limit'
+        and: 'all data is read within #durationLimit seconds and memory used is within limit'
             recordAndAssertResourceUsage("Query with ${scenario}", durationLimit, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
         where: 'the following parameters are used'
             scenario             | fetchDescendantsOption  || durationLimit  | memoryLimit   | expectedNumberOfDataNodes
@@ -95,7 +95,7 @@ class QueryPerfTest extends CpsPerfTestBase {
             def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
         then: 'the expected number of nodes is returned'
             assert countDataNodesInTree(result) == expectedNumberOfDataNodes
-        and: 'all data is read within #durationLimit ms and memory used is within limit'
+        and: 'all data is read within #durationLimit seconds and memory used is within limit'
             recordAndAssertResourceUsage("Query ancestors with ${scenario}", durationLimit, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
         where: 'the following parameters are used'
             scenario             | fetchDescendantsOption  || durationLimit  | memoryLimit | expectedNumberOfDataNodes
@@ -103,4 +103,22 @@ class QueryPerfTest extends CpsPerfTestBase {
             'direct descendants' | DIRECT_CHILDREN_ONLY    || 0.11           | 8           | 1 + OPENROADM_DEVICES_PER_ANCHOR
             'all descendants'    | INCLUDE_ALL_DESCENDANTS || 1.34           | 400         | 1 + OPENROADM_DEVICES_PER_ANCHOR * OPENROADM_DATANODES_PER_DEVICE
     }
+
+    def 'Query data leaf with #scenario.'() {
+        when: 'query data leaf is called'
+            resourceMeter.start()
+            def result = objectUnderTest.queryDataLeaf(CPS_PERFORMANCE_TEST_DATASPACE, 'openroadm1', cpsPath, String)
+            resourceMeter.stop()
+            def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
+        then: 'the expected number of results is returned'
+            assert result.size() == expectedNumberOfValues
+        and: 'all data is read within #durationLimit seconds and memory used is within limit'
+            recordAndAssertResourceUsage("Query data leaf ${scenario}", durationLimit, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB())
+        where: 'the following parameters are used'
+            scenario                     | cpsPath                                             || durationLimit  | memoryLimit  | expectedNumberOfValues
+            'unique leaf value'          | '/openroadm-devices/openroadm-device/@device-id'    || 0.10           | 8            | OPENROADM_DEVICES_PER_ANCHOR
+            'common leaf value'          | '/openroadm-devices/openroadm-device/@ne-state'     || 0.05           | 1            | 1
+            'non-existing data leaf'     | '/openroadm-devices/openroadm-device/@non-existing' || 0.05           | 1            | 0
+    }
+
 }