X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=integration-test%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fintegration%2Fperformance%2Fbase%2FPerfTestBase.groovy;h=b0a105c7fe797f08d5a088a119cfd40d80a73c10;hb=e082710eaff7ef813f474e8adc56358dab8debc5;hp=4afdabe924273ac1eb4cbbf1ae6fa106161d9612;hpb=2f8c7e8844b9ea68247ed12f02d1d6b8b8792857;p=cps.git diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/PerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/PerfTestBase.groovy index 4afdabe92..b0a105c7f 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/PerfTestBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/PerfTestBase.groovy @@ -28,16 +28,14 @@ abstract class PerfTestBase extends CpsIntegrationSpecBase { static def LARGE_SCHEMA_SET = 'largeSchemaSet' static def PERFORMANCE_RECORD = [] - def stopWatch = new StopWatch() - def cleanupSpec() { - println('#############################################################################') + println('##################################################################################################') printTitle() - println('#############################################################################') + println('##################################################################################################') PERFORMANCE_RECORD.sort().each { println(it) } - println('#############################################################################') + println('##################################################################################################') PERFORMANCE_RECORD.clear() } @@ -56,15 +54,16 @@ abstract class PerfTestBase extends CpsIntegrationSpecBase { abstract def createInitialData() - def recordAndAssertPerformance(String shortTitle, thresholdInMs, recordedTimeInMs) { - def pass = recordedTimeInMs <= thresholdInMs + def recordAndAssertResourceUsage(String shortTitle, double thresholdInSec, double recordedTimeInSec, memoryLimit, memoryUsageInMB) { + def pass = recordedTimeInSec <= thresholdInSec if (shortTitle.length() > 40) { shortTitle = shortTitle.substring(0, 40) } - def record = String.format('%2d.%-40s limit%,7d took %,7d ms ', PERFORMANCE_RECORD.size() + 1, shortTitle, thresholdInMs, recordedTimeInMs) + def record = String.format('%2d.%-40s limit %8.2f took %8.2f sec %,8.2f MB used ', PERFORMANCE_RECORD.size() + 1, shortTitle, thresholdInSec, recordedTimeInSec, memoryUsageInMB) record += pass ? 'PASS' : 'FAIL' PERFORMANCE_RECORD.add(record) - assert recordedTimeInMs <= thresholdInMs + assert recordedTimeInSec <= thresholdInSec + assert memoryUsageInMB <= memoryLimit return true } }