Skip to content

Commit

Permalink
switch to a different repo to avoid test collisions
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Sep 22, 2023
1 parent 44754c1 commit 51df393
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@
import org.junit.jupiter.api.Test;

class HelmInstallChartTaskTest {
private static final Repository BITNAMI_REPOSITORY =
new Repository("bitnami", "https://charts.bitnami.com/bitnami");
private static final Chart BITNAMI_CHART = new Chart("mysql", "bitnami");
private static final Repository REPOSITORY = new Repository("stable", "https://charts.helm.sh/stable");
private static final Chart CHART = new Chart("mysql", "stable");

private static final String BITNAMI_RELEASE_NAME = "bitnami-release";
private static final String RELEASE_NAME = "mysql-release";

private static Project project;

Expand Down Expand Up @@ -81,26 +80,26 @@ void testHelmInstallChartTaskForHederaNetworkChart() throws IOException {
void testHelmInstallChartTaskSimple() {
HelmClient helmClient =
HelmClient.builder().defaultNamespace("simple-test").build();
suppressExceptions(() -> helmClient.uninstallChart(BITNAMI_RELEASE_NAME));
suppressExceptions(() -> helmClient.removeRepository(BITNAMI_REPOSITORY));
suppressExceptions(() -> helmClient.uninstallChart(RELEASE_NAME));
suppressExceptions(() -> helmClient.removeRepository(REPOSITORY));
final List<Repository> repositories = helmClient.listRepositories();
if (!repositories.contains(BITNAMI_REPOSITORY)) {
helmClient.addRepository(BITNAMI_REPOSITORY);
if (!repositories.contains(REPOSITORY)) {
helmClient.addRepository(REPOSITORY);
}
try {
HelmInstallChartTask helmInstallChartTask = project.getTasks()
.create("helmInstallChart", HelmInstallChartTask.class, task -> {
task.getChart().set(BITNAMI_CHART.name());
task.getChart().set(CHART.name());
task.getCreateNamespace().set(true);
task.getNamespace().set("simple-test");
task.getRelease().set(BITNAMI_RELEASE_NAME);
task.getRepo().set(BITNAMI_CHART.repoName());
task.getRelease().set(RELEASE_NAME);
task.getRepo().set(CHART.repoName());
});
assertEquals(BITNAMI_RELEASE_NAME, helmInstallChartTask.getRelease().get());
assertEquals(RELEASE_NAME, helmInstallChartTask.getRelease().get());
helmInstallChartTask.installChart();
} finally {
suppressExceptions(() -> helmClient.uninstallChart(BITNAMI_RELEASE_NAME));
suppressExceptions(() -> helmClient.removeRepository(BITNAMI_REPOSITORY));
suppressExceptions(() -> helmClient.uninstallChart(RELEASE_NAME));
suppressExceptions(() -> helmClient.removeRepository(REPOSITORY));
}
}
}

0 comments on commit 51df393

Please sign in to comment.