diff options
author | 2021-07-07 20:37:54 +0100 | |
---|---|---|
committer | 2021-07-14 17:25:56 +0100 | |
commit | dfd1e716f8e840f7caaf42e14572d18c8acc9d38 (patch) | |
tree | cda28418d512bc5a16ad5a567547a2bbd33333c8 /participant/participant-impl/participant-impl-kubernetes/src/test/java/org.onap.policy.clamp.controlloop.participant.kubernetes/helm/HelmClientTest.java | |
parent | fa8bac11d88cca8bd86f6a5687034449a961e1ec (diff) |
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 <ramesh.murugan.iyer@est.tech>
Change-Id: Ibcbe79d07caa9bff12de341c3d88c36a144796bc
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/java/org.onap.policy.clamp.controlloop.participant.kubernetes/helm/HelmClientTest.java')
-rw-r--r-- | participant/participant-impl/participant-impl-kubernetes/src/test/java/org.onap.policy.clamp.controlloop.participant.kubernetes/helm/HelmClientTest.java | 17 |
1 files changed, 13 insertions, 4 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 5f8b7dc78..370bfa6ce 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 @@ -33,6 +33,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.List; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -49,6 +50,7 @@ import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.util.FileSystemUtils; @ExtendWith(SpringExtension.class) @@ -74,6 +76,12 @@ class HelmClientTest { mockedClient = mockStatic(HelmClient.class); } + @AfterAll + public static void close() throws IOException { + mockedClient.close(); + FileSystemUtils.deleteRecursively(Path.of("target/tmp")); + } + @Test void test_installChart() throws IOException { mockedClient.when(() -> HelmClient.executeCommand(any())) @@ -85,21 +93,22 @@ class HelmClientTest { @Test void test_findChartRepository() throws IOException, ServiceException { + String tmpPath = "target/tmp/dummyChart/1.0/"; mockedClient.when(() -> HelmClient.executeCommand(Mockito.any())) .thenReturn("nginx-stable/nginx-ingress\t0.9.3\t1.11.3" + " \tNGINX Ingress Controller"); String configuredRepo = helmClient.findChartRepository(charts.get(1)); - assertThat(configuredRepo).isEqualTo("nginx-stable"); - doReturn(Path.of("/target/tmp/dummyChart/1.0")).when(chartStore).getAppPath(charts.get(1).getChartName(), - charts.get(1).getVersion()); + File tmpFile = new File(tmpPath + charts.get(1).getChartId().getName()); + tmpFile.mkdirs(); + doReturn(Path.of(tmpPath)).when(chartStore).getAppPath(charts.get(1).getChartId()); doReturn(null).when(helmClient).verifyConfiguredRepo(charts.get(1)); String localRepoName = helmClient.findChartRepository(charts.get(1)); assertNotNull(localRepoName); - assertThat(localRepoName).endsWith(charts.get(0).getVersion()); + assertThat(localRepoName).endsWith(charts.get(0).getChartId().getVersion()); } @Test |