From dfd1e716f8e840f7caaf42e14572d18c8acc9d38 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Wed, 7 Jul 2021 20:37:54 +0100 Subject: Support override parameters for k8s-participant Add support for helm chart override parameters in TOSCA. Add support for monitoring Pod status after deployment. Note: ONAP Helm charts from OOM repository needs a global master password to be provided along with the helm command. Looking for suggestions here to avoid passing clear text password in TOSCA (KubernetesHelm.yaml). Thanks Issue-ID: POLICY-3433 Signed-off-by: zrrmmua Change-Id: Ibcbe79d07caa9bff12de341c3d88c36a144796bc --- .../rest/ChartControllerTest.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/java/org.onap.policy.clamp.controlloop.participant.kubernetes/rest') 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 1a1bdae5b..a28fd9ebe 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 @@ -93,7 +93,7 @@ class ChartControllerTest { @BeforeEach void mockServiceClass() { when(chartService.getAllCharts()).thenReturn(charts); - when(chartService.getChart(charts.get(0).getChartName(), charts.get(0).getVersion())) + when(chartService.getChart(charts.get(0).getChartId().getName(), charts.get(0).getChartId().getVersion())) .thenReturn(charts.get(0)); this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); @@ -110,7 +110,7 @@ class ChartControllerTest { mockMvc.perform(requestBuilder).andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.charts.[0].chartName", is("HelloWorld"))); + .andExpect(jsonPath("$.charts.[0].chartId.name", is("HelloWorld"))); } /** @@ -125,7 +125,7 @@ class ChartControllerTest { doNothing().when(chartService).installChart(charts.get(0)); requestBuilder = MockMvcRequestBuilders.post(INSTALL_CHART_URL).accept(MediaType.APPLICATION_JSON_VALUE) - .content(getInstallationJson(charts.get(0).getChartName(), charts.get(0).getVersion())) + .content(getInstallationJson(charts.get(0).getChartId().getName(), charts.get(0).getChartId().getVersion())) .contentType(MediaType.APPLICATION_JSON_VALUE); mockMvc.perform(requestBuilder).andExpect(status().isCreated()); @@ -149,9 +149,9 @@ class ChartControllerTest { //Mocking successful scenario for void uninstall method doNothing().when(chartService).uninstallChart(charts.get(0)); - requestBuilder = MockMvcRequestBuilders.delete(UNINSTALL_CHART_URL + charts.get(0).getChartName() - + "/" + charts.get(0).getVersion()).accept(MediaType.APPLICATION_JSON_VALUE) - .contentType(MediaType.APPLICATION_JSON_VALUE); + requestBuilder = MockMvcRequestBuilders.delete(UNINSTALL_CHART_URL + charts.get(0) + .getChartId().getName() + "/" + charts.get(0).getChartId().getVersion()) + .accept(MediaType.APPLICATION_JSON_VALUE).contentType(MediaType.APPLICATION_JSON_VALUE); mockMvc.perform(requestBuilder).andExpect(status().isNoContent()); @@ -196,8 +196,9 @@ class ChartControllerTest { //Mocking successful scenario for void uninstall method doNothing().when(chartService).deleteChart(charts.get(0)); - requestBuilder = MockMvcRequestBuilders.delete(DEFAULT_CHART_URL + "/" + charts.get(0).getChartName() - + "/" + charts.get(0).getVersion()).accept(MediaType.APPLICATION_JSON_VALUE) + requestBuilder = MockMvcRequestBuilders.delete(DEFAULT_CHART_URL + "/" + charts.get(0) + .getChartId().getName() + "/" + charts.get(0).getChartId().getVersion()) + .accept(MediaType.APPLICATION_JSON_VALUE) .contentType(MediaType.APPLICATION_JSON_VALUE); mockMvc.perform(requestBuilder).andExpect(status().isNoContent()); @@ -219,8 +220,8 @@ class ChartControllerTest { private String getChartInfoJson() { JSONObject jsonObj = new JSONObject(); - jsonObj.put("chartName", charts.get(0).getChartName()); - jsonObj.put("version", charts.get(0).getVersion()); + jsonObj.put("chartName", charts.get(0).getChartId().getName()); + jsonObj.put("version", charts.get(0).getChartId().getVersion()); jsonObj.put("namespace", charts.get(0).getNamespace()); jsonObj.put("repository", charts.get(0).getRepository()); jsonObj.put("releaseName", charts.get(0).getReleaseName()); -- cgit 1.2.3-korg