summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2023-04-28 15:02:00 +0100
committermpriyank <priyank.maheshwari@est.tech>2023-05-02 12:09:29 +0100
commit74cf06f7af65c699187f9e268db58023db2e2a62 (patch)
treefc9439384f1b5336e337da62f0841c969aded8fc /cps-ncmp-service/src/test/groovy/org
parent5f964d1910e309502530631bff4d21e5d59f4dc8 (diff)
Align the hazelcast cluster names
- We need to align the hazelcast cluster names as members of the same cluster can join each other. We will still have exclusivity as the instance names and configs are different for each distributed object. - Exposing env variable to override the cluster name depending on the env it is run on. - Modified test cases to validate the cluster names as well Issue-ID: CPS-1637 Change-Id: Ib0f8c80dc9b2268f976b0c2d3ccd6d64792d4781 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy26
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy8
2 files changed, 22 insertions, 12 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
index 567debdded..c0fc18abfc 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
@@ -59,20 +59,28 @@ class SynchronizationCacheConfigSpec extends Specification {
def 'Verify configs for Distributed objects'(){
given: 'the Module Sync Work Queue config'
- def queueConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncWorkQueue').config.queueConfigs.get('defaultQueueConfig')
+ def moduleSyncWorkQueueConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncWorkQueue').config
+ def moduleSyncDefaultWorkQueueConfig = moduleSyncWorkQueueConfig.queueConfigs.get('defaultQueueConfig')
and: 'the Module Sync Started Cm Handle Map config'
- def moduleSyncStartedOnCmHandlesConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncStartedOnCmHandles').config.mapConfigs.get('moduleSyncStartedConfig')
+ def moduleSyncStartedOnCmHandlesConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncStartedOnCmHandles').config
+ def moduleSyncStartedOnCmHandlesMapConfig = moduleSyncStartedOnCmHandlesConfig.mapConfigs.get('moduleSyncStartedConfig')
and: 'the Data Sync Semaphores Map config'
- def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config.mapConfigs.get('dataSyncSemaphoresConfig')
+ def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config
+ def dataSyncSemaphoresMapConfig = dataSyncSemaphoresConfig.mapConfigs.get('dataSyncSemaphoresConfig')
expect: 'system created instance with correct config of Module Sync Work Queue'
- assert queueConfig.backupCount == 3
- assert queueConfig.asyncBackupCount == 3
+ assert moduleSyncDefaultWorkQueueConfig.backupCount == 3
+ assert moduleSyncDefaultWorkQueueConfig.asyncBackupCount == 3
and: 'Module Sync Started Cm Handle Map has the correct settings'
- assert moduleSyncStartedOnCmHandlesConfig.backupCount == 3
- assert moduleSyncStartedOnCmHandlesConfig.asyncBackupCount == 3
+ assert moduleSyncStartedOnCmHandlesMapConfig.backupCount == 3
+ assert moduleSyncStartedOnCmHandlesMapConfig.asyncBackupCount == 3
and: 'Data Sync Semaphore Map has the correct settings'
- assert dataSyncSemaphoresConfig.backupCount == 3
- assert dataSyncSemaphoresConfig.asyncBackupCount == 3
+ assert dataSyncSemaphoresMapConfig.backupCount == 3
+ assert dataSyncSemaphoresMapConfig.asyncBackupCount == 3
+ and: 'all instances are part of same cluster'
+ def testClusterName = 'cps-and-ncmp-test-caches'
+ assert moduleSyncWorkQueueConfig.clusterName == testClusterName
+ assert moduleSyncStartedOnCmHandlesConfig.clusterName == testClusterName
+ assert dataSyncSemaphoresConfig.clusterName == testClusterName
}
def 'Verify deployment network configs for Distributed objects'() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
index 7448daf598..03d3a1c105 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
@@ -44,10 +44,12 @@ class ForwardedSubscriptionEventCacheConfigSpec extends Specification {
def 'Verify configs for Distributed Caches'(){
given: 'the Forwarded Subscription Event Cache config'
- def forwardedSubscriptionEventCacheConfig = Hazelcast.getHazelcastInstanceByName('hazelCastInstanceSubscriptionEvents').config.mapConfigs.get('forwardedSubscriptionEventCacheMapConfig')
+ def forwardedSubscriptionEventCacheConfig = Hazelcast.getHazelcastInstanceByName('hazelCastInstanceSubscriptionEvents').config
+ def forwardedSubscriptionEventCacheMapConfig = forwardedSubscriptionEventCacheConfig.mapConfigs.get('forwardedSubscriptionEventCacheMapConfig')
expect: 'system created instance with correct config'
- assert forwardedSubscriptionEventCacheConfig.backupCount == 3
- assert forwardedSubscriptionEventCacheConfig.asyncBackupCount == 3
+ assert forwardedSubscriptionEventCacheConfig.clusterName == 'cps-and-ncmp-test-caches'
+ assert forwardedSubscriptionEventCacheMapConfig.backupCount == 3
+ assert forwardedSubscriptionEventCacheMapConfig.asyncBackupCount == 3
}
def 'Verify deployment network configs for Distributed Caches'() {