diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2024-07-11 12:16:43 +0100 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2024-07-11 12:30:23 +0100 |
commit | dfd3c3180b3e9e17bf42fc102dffd941234fbe41 (patch) | |
tree | 56f83f160e958826ea8a35c3c80c3f87e12c9507 | |
parent | 93b52651f0fce4a2d60cd0aa6538e4155115e649 (diff) |
Fix timing issue in CmHandleCreateSpec
The test for module sync retry on LOCKED handles has a timing issue,
due the ordering of the steps. After a LOCKED handle gets reset to
ADVISED state (but DMI is not yet set to available), the Module Sync
Watchdog may wake up and put it back into LOCKED state again.
This fix is to first make the DMI available before waiting for the
LOCKED handle to reset.
Issue-ID: CPS-2304
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I9d33b0eeea1e0a2e163489130c928b4d03182774
-rw-r--r-- | integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy index 914f562a2f..c9a64e0ab8 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/CmHandleCreateSpec.groovy @@ -138,41 +138,28 @@ class CmHandleCreateSpec extends CpsIntegrationSpecBase { dmiDispatcher.isAvailable = false when: 'CM-handles are registered for creation' - def cmHandlesToCreate = [new NcmpServiceCmHandle(cmHandleId: 'ch-1'), new NcmpServiceCmHandle(cmHandleId: 'ch-2')] + def cmHandlesToCreate = [new NcmpServiceCmHandle(cmHandleId: 'ch-1')] def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: DMI_URL, createdCmHandles: cmHandlesToCreate) objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration) then: 'CM-handles go to LOCKED state' new PollingConditions().within(MODULE_SYNC_WAIT_TIME_IN_SECONDS, () -> { assert objectUnderTest.getCmHandleCompositeState('ch-1').cmHandleState == CmHandleState.LOCKED - assert objectUnderTest.getCmHandleCompositeState('ch-2').cmHandleState == CmHandleState.LOCKED }) - when: 'we wait for LOCKED CM handle retry time (actually just subtract 3 minutes from handles lastUpdateTime)' + when: 'DMI is available for retry' + dmiDispatcher.moduleNamesPerCmHandleId = ['ch-1': ['M1', 'M2']] + dmiDispatcher.isAvailable = true + and: 'the LOCKED CM handle retry time elapses (actually just subtract 3 minutes from handles lastUpdateTime)' overrideCmHandleLastUpdateTime('ch-1', OffsetDateTime.now().minusMinutes(3)) - overrideCmHandleLastUpdateTime('ch-2', OffsetDateTime.now().minusMinutes(3)) - then: 'CM-handles go to ADVISED state' - new PollingConditions().within(MODULE_SYNC_WAIT_TIME_IN_SECONDS, () -> { - assert objectUnderTest.getCmHandleCompositeState('ch-1').cmHandleState == CmHandleState.ADVISED - assert objectUnderTest.getCmHandleCompositeState('ch-2').cmHandleState == CmHandleState.ADVISED - }) - when: 'DMI will return expected modules' - dmiDispatcher.moduleNamesPerCmHandleId = ['ch-1': ['M1', 'M2'], 'ch-2': ['M1', 'M3']] - and: 'DMI is available for retry' - dmiDispatcher.isAvailable = true - then: 'CM-handles go to READY state' + then: 'CM-handle goes to READY state' new PollingConditions().within(MODULE_SYNC_WAIT_TIME_IN_SECONDS, () -> { assert objectUnderTest.getCmHandleCompositeState('ch-1').cmHandleState == CmHandleState.READY - assert objectUnderTest.getCmHandleCompositeState('ch-2').cmHandleState == CmHandleState.READY }) - and: 'CM-handles have expected modules' + and: 'CM-handle has expected modules' assert ['M1', 'M2'] == objectUnderTest.getYangResourcesModuleReferences('ch-1').moduleName.sort() - assert ['M1', 'M3'] == objectUnderTest.getYangResourcesModuleReferences('ch-2').moduleName.sort() - and: 'CM-handles have expected module set tags (blank)' - assert objectUnderTest.getNcmpServiceCmHandle('ch-1').moduleSetTag == '' - assert objectUnderTest.getNcmpServiceCmHandle('ch-2').moduleSetTag == '' cleanup: 'deregister CM handle' - deregisterCmHandles(DMI_URL, ['ch-1', 'ch-2']) + deregisterCmHandle(DMI_URL, 'ch-1') } } |