From 337ca7b2f98c439e33cacd4b10f1227d511fe101 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Fri, 16 Aug 2024 14:15:23 +0100 Subject: 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 --- .../functional/cps/DataServiceIntegrationSpec.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'integration-test/src/test') 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'() { -- cgit 1.2.3-korg