summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl
diff options
context:
space:
mode:
authorlapentafd <francesco.lapenta@est.tech>2021-11-02 09:10:54 +0000
committerlapentafd <francesco.lapenta@est.tech>2021-11-02 09:27:09 +0000
commit5ee631b91871fefafce35c5399aef10984f1207f (patch)
tree6095f6094a5608ce34baa81f30afa6d7c8880fd2 /participant/participant-impl
parent9a49920ac001f76d796cbffce823abd7c0c7d9e2 (diff)
Clamp code coverage
Issue-ID: POLICY-3452 Change-Id: I35c10562c5e11698491a5d93adcf417784395534 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Diffstat (limited to 'participant/participant-impl')
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java5
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java18
2 files changed, 22 insertions, 1 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java
index 79a37f8e6..41b1fbeb5 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClientTest.java
@@ -89,7 +89,10 @@ class HelmClientTest {
.thenReturn("success");
doReturn(new File("/target/tmp/override.yaml")).when(chartStore)
.getOverrideFile(any());
- assertDoesNotThrow(() -> helmClient.installChart(charts.get(0)));
+ var chartinfo = charts.get(0);
+ assertDoesNotThrow(() -> helmClient.installChart(chartinfo));
+ chartinfo.setNamespace("");
+ assertDoesNotThrow(() -> helmClient.installChart(chartinfo));
}
@Test
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java
index bbb57c320..2af2a0171 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/controlloop/participant/kubernetes/rest/ChartControllerTest.java
@@ -73,6 +73,7 @@ class ChartControllerTest {
private static String UNINSTALL_CHART_URL = "/helm/uninstall/";
private static String ONBOARD_CHART_URL = "/helm/onboard/chart";
private static String DELETE_CHART_URL = "/helm/chart";
+ private static String CONFIGURE_REPO_URL = "/helm/repo";
@Autowired
private MockMvc mockMvc;
@@ -217,6 +218,23 @@ class ChartControllerTest {
}
+ /**
+ * Test endpoint for configuring a helm repository.
+ * @throws Exception in case of error.
+ */
+ @Test
+ void testConfigureRepo() throws Exception {
+ RequestBuilder requestBuilder;
+
+ requestBuilder = MockMvcRequestBuilders.post(CONFIGURE_REPO_URL).accept(MediaType.APPLICATION_JSON_VALUE)
+ .content(getInstallationJson(charts.get(0).getChartId().getName(), charts.get(0).getChartId().getVersion()))
+ .contentType(MediaType.APPLICATION_JSON_VALUE);
+
+ mockMvc.perform(requestBuilder).andExpect(status().isCreated());
+
+ }
+
+
private String getInstallationJson(String name, String version) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("name", name);