Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions helm-java/src/test/java/com/marcnuri/helm/HelmKubernetesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ void withoutSkipCrdsInstallsCrds() {
.returns("helm-install-with-crds", Release::getName)
.returns("deployed", Release::getStatus)
.extracting(Release::getOutput).asString()
.contains("installwidgets.helm-java.example.com");
.contains("creating 1 resource(s)") // CRD creation
.contains("creating 3 resource(s)"); // Rest of the resources
}

@Test
Expand All @@ -225,7 +226,8 @@ void skipCrdsDoesNotInstallCrds() {
.returns("helm-install-skip-crds", Release::getName)
.returns("deployed", Release::getStatus)
.extracting(Release::getOutput).asString()
.doesNotContain("installwidgets.helm-java.example.com");
.doesNotContain("creating 1 resource(s)") // CRD creation
.contains("creating 3 resource(s)"); // Rest of the resources
}
}

Expand Down Expand Up @@ -662,38 +664,44 @@ void setUp() throws IOException {
" openAPIV3Schema:\n" +
" type: object\n").getBytes(StandardCharsets.UTF_8),
StandardOpenOption.CREATE);
// Install the chart first to have a release to upgrade
helmWithCrds.install()
.withKubeConfig(kubeConfigFile)
.withName("upgrade-crd-release")
.call();
}

@AfterEach
void tearDown() {
Helm.uninstall("upgrade-crd-release").withKubeConfig(kubeConfigFile).call();
}

@Test
void withoutSkipCrdsIncludesCrds() {
final Release result = helmWithCrds.upgrade()
.withKubeConfig(kubeConfigFile)
.withName("upgrade-crd-release")
.install()// Forces an installation if no prior release exists (including CRDs)
.debug()
.call();
assertThat(result)
.returns("2", Release::getRevision)
.returns("deployed", Release::getStatus);
.returns("1", Release::getRevision)
.returns("deployed", Release::getStatus)
.extracting(Release::getOutput).asString()
.contains("creating 1 resource(s)") // CRD creation
.contains("creating 3 resource(s)"); // Rest of the resources
}

@Test
void skipCrdsExcludesCrds() {
final Release result = helmWithCrds.upgrade()
.withKubeConfig(kubeConfigFile)
.withName("upgrade-crd-release")
.install() // Forces an installation if no prior release exists (including CRDs)
.skipCrds()
.debug()
.call();
assertThat(result)
.returns("2", Release::getRevision)
.returns("1", Release::getRevision)
.returns("deployed", Release::getStatus)
.extracting(Release::getOutput).asString()
.doesNotContain("upgradewidgets.helm-java.example.com");
.doesNotContain("creating 1 resource(s)") // CRD creation
.contains("creating 3 resource(s)"); // Rest of the resources
}
}

Expand Down
Loading