aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy22
1 files changed, 12 insertions, 10 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
index 8fdbb6f53..00d14cd2a 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
@@ -115,11 +115,11 @@ class SyncUtilsSpec extends Specification{
def 'Get all locked Cm-Handle where Lock Reason is MODULE_SYNC_FAILED cm handle #scenario'() {
given: 'the cps (persistence service) returns a collection of data nodes'
- mockCmHandleQueries.queryCmHandleDataNodesByCpsPath(
- '//lock-reason[@reason="MODULE_SYNC_FAILED"]',
+ mockCmHandleQueries.queryCmHandleAncestorsByCpsPath(
+ '//lock-reason[@reason="MODULE_SYNC_FAILED" or @reason="MODULE_UPGRADE"]',
FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> [dataNode]
when: 'get locked Misbehaving cm handle is called'
- def result = objectUnderTest.getModuleSyncFailedCmHandles()
+ def result = objectUnderTest.getCmHandlesThatFailedModelSyncOrUpgrade()
then: 'the returned cm handle collection is the correct size'
result.size() == 1
and: 'the correct cm handle is returned'
@@ -133,7 +133,7 @@ class SyncUtilsSpec extends Specification{
lastUpdatedTime = neverUpdatedBefore
}
when: 'checking to see if cm handle is ready for retry'
- def result = objectUnderTest.needsModuleSyncRetry(new CompositeStateBuilder()
+ def result = objectUnderTest.needsModuleSyncRetryOrUpgrade(new CompositeStateBuilder()
.withLockReason(MODULE_SYNC_FAILED, lockDetails)
.withLastUpdatedTime(lastUpdatedTime).build())
then: 'retry is only attempted when expected'
@@ -151,16 +151,18 @@ class SyncUtilsSpec extends Specification{
def 'Retry Locked Cm-Handle with other lock reasons (category) #lockReasonCategory'() {
when: 'checking to see if cm handle is ready for retry'
- def result = objectUnderTest.needsModuleSyncRetry(new CompositeStateBuilder()
+ def result = objectUnderTest.needsModuleSyncRetryOrUpgrade(new CompositeStateBuilder()
.withLockReason(lockReasonCategory, 'some details')
.withLastUpdatedTime(nowAsString).build())
- then: 'retry attempt is never triggered'
- assert result == false
+ then: 'verify retry attempts'
+ assert result == retryAttempt
and: 'logs contain related information'
- def logs = loggingListAppender.list.toString()
- assert logs.contains('Locked for other reason')
+ def logs = loggingListAppender.list.toString()
+ assert logs.contains(logReason)
where: 'the following lock reasons occurred'
- lockReasonCategory << [MODULE_UPGRADE, MODULE_UPGRADE_FAILED]
+ scenario | lockReasonCategory || logReason | retryAttempt
+ 'module upgrade' | MODULE_UPGRADE || 'Locked for module upgrade.' | true
+ 'module sync failed' | MODULE_SYNC_FAILED || 'First Attempt:' | false
}
def 'Get a Cm-Handle where #scenario'() {