diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-07 13:47:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-07 13:47:58 +0000 |
commit | 2baf9ec970e8f4901deabbd7d7bcb5cf54607201 (patch) | |
tree | f13809fb8a1da735744d7aa8924a8bcdf0582be2 /main/src/test | |
parent | 1dc9c599a0aa339cac04633f5b2d77c6c414e66b (diff) | |
parent | c0d20132b774b1fa43b4fb9b322e13b6d19d33ee (diff) |
Merge "Fail component health check if PDP is down"
Diffstat (limited to 'main/src/test')
3 files changed, 18 insertions, 1 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java index c910a986..0babb71d 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupHealthCheckProvider.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +89,7 @@ public class TestPdpGroupHealthCheckProvider { } private void verifyPdps(final List<Pdp> pdpList, final List<PdpGroup> groups) { - assertEquals(5, pdpList.size()); + assertEquals(6, pdpList.size()); for (final PdpGroup group : groups) { for (final PdpSubGroup subGroup : group.getPdpSubgroups()) { pdpList.containsAll(subGroup.getPdpInstances()); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java index bdf4700c..ff2159d2 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckProvider.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2020 AT&T Corp. + * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -193,6 +194,14 @@ public class TestPolicyComponentsHealthCheckProvider { } @Test + public void testFetchPolicyComponentsHealthStatus_PdpDown() { + // Set currentInstanceCount as 0 to simulate PDP down + groups.get(0).getPdpSubgroups().get(0).setCurrentInstanceCount(0); + Map<String, Object> result = callFetchPolicyComponentsHealthStatus(); + assertFalse((Boolean) result.get(HEALTHY)); + } + + @Test public void testFetchPolicyComponentsHealthStatus_unhealthyPap() { when(papActivator.isAlive()).thenReturn(false); Map<String, Object> result = callFetchPolicyComponentsHealthStatus(); diff --git a/main/src/test/resources/rest/pdpGroup.json b/main/src/test/resources/rest/pdpGroup.json index 2a7b4edc..279d8079 100644 --- a/main/src/test/resources/rest/pdpGroup.json +++ b/main/src/test/resources/rest/pdpGroup.json @@ -25,6 +25,11 @@ "instanceId": "pdpAA_2", "pdpState": "PASSIVE", "healthy": "HEALTHY" + }, + { + "instanceId": "pdpAA_3", + "pdpState": "PASSIVE", + "healthy": "HEALTHY" } ], "supportedPolicyTypes": [ @@ -42,6 +47,7 @@ }, { "pdpType": "pdpTypeB", + "currentInstanceCount": 1, "desiredInstanceCount": 1, "pdpInstances": [ { @@ -66,6 +72,7 @@ "pdpSubgroups": [ { "pdpType": "pdpTypeA", + "currentInstanceCount": 2, "desiredInstanceCount": 2, "pdpInstances": [ { |