diff options
author | Liam Fallon <liam.fallon@est.tech> | 2021-11-03 14:28:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-11-03 14:28:22 +0000 |
commit | 7bc53b8dd7c12dc108ad2625ad6d4c14804e76a6 (patch) | |
tree | 383b704a9e4aa4072c634b57617a7c92338ebe79 /participant/participant-impl/participant-impl-kubernetes | |
parent | a48252db26e2ccd031ddb2046d87737d47c248a6 (diff) | |
parent | 5ee631b91871fefafce35c5399aef10984f1207f (diff) |
Merge "Clamp code coverage"
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes')
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); |