From: danielhanrahan Date: Fri, 16 Aug 2024 13:15:23 +0000 (+0100) Subject: Fix intermittent test failure of Delta between anchors X-Git-Tag: 3.5.2~11^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F77%2F138777%2F1;p=cps.git Fix intermittent test failure of Delta between anchors Test fails sometimes due to non-deterministic order of results. The issue is fixed by sorting the delta reports. Issue-ID: CPS-2369 Signed-off-by: danielhanrahan Change-Id: I60fd459a482a7e3dc209ee3056794817d37f5149 --- diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataServiceIntegrationSpec.groovy index b274324d71..d8395d0c91 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataServiceIntegrationSpec.groovy @@ -459,17 +459,19 @@ class DataServiceIntegrationSpec extends FunctionalSpecBase { def 'Get delta between 2 anchors'() { when: 'attempt to get delta report between anchors' def result = objectUnderTest.getDeltaByDataspaceAndAnchors(FUNCTIONAL_TEST_DATASPACE_3, BOOKSTORE_ANCHOR_3, BOOKSTORE_ANCHOR_5, '/', OMIT_DESCENDANTS) + and: 'report is ordered based on xpath' + result = result.toList().sort { it.xpath } then: 'delta report contains expected number of changes' result.size() == 3 and: 'delta report contains UPDATE action with expected xpath' assert result[0].getAction() == 'update' assert result[0].getXpath() == '/bookstore' - and: 'delta report contains REMOVE action with expected xpath' - assert result[1].getAction() == 'remove' - assert result[1].getXpath() == "/bookstore-address[@bookstore-name='Easons-1']" and: 'delta report contains ADD action with expected xpath' - assert result[2].getAction() == 'add' - assert result[2].getXpath() == "/bookstore-address[@bookstore-name='Crossword Bookstores']" + assert result[1].getAction() == 'add' + assert result[1].getXpath() == "/bookstore-address[@bookstore-name='Crossword Bookstores']" + and: 'delta report contains REMOVE action with expected xpath' + assert result[2].getAction() == 'remove' + assert result[2].getXpath() == "/bookstore-address[@bookstore-name='Easons-1']" } def 'Get delta between 2 anchors returns empty response when #scenario'() {