-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test (gradle-plugin/it) : revert changes to FileDataSecretEnricher an…
…d add a separate test for windows + Revert changes to FileDataSecretEnricher + Add a separate test for windows that would provide expected files with windows line endings Signed-off-by: Rohan Kumar <rohaan@redhat.com>
- Loading branch information
1 parent
655865f
commit 8c7659e
Showing
5 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
gradle-plugin/it/src/it/secret-file/expected/kubernetes_windows_line_endings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
labels: | ||
app: secret-file | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
name: secret-file | ||
data: | ||
# This contains application properties content with windows style line endings (CRLF) | ||
application.properties: a2V5MSA9IHZhbHVlMQ0Ka2V5MiA9IHZhbHVlMg0Ka2V5MyA9IHZhbHVlMw== |
16 changes: 16 additions & 0 deletions
16
gradle-plugin/it/src/it/secret-file/expected/openshift_windows_line_endings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
labels: | ||
app: secret-file | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
name: secret-file | ||
data: | ||
# This contains application properties content with windows style line endings (CRLF) | ||
application.properties: a2V5MSA9IHZhbHVlMQ0Ka2V5MiA9IHZhbHVlMg0Ka2V5MyA9IHZhbHVlMw== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...le-plugin/it/src/test/java/org/eclipse/jkube/gradle/plugin/tests/FileSecretWindowsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.gradle.plugin.tests; | ||
|
||
import net.minidev.json.parser.ParseException; | ||
import org.eclipse.jkube.kit.common.ResourceVerify; | ||
import org.gradle.testkit.runner.BuildResult; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledOnOs; | ||
import org.junit.jupiter.api.condition.OS; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
@EnabledOnOs(OS.WINDOWS) | ||
class FileSecretWindowsIT { | ||
@RegisterExtension | ||
private final ITGradleRunnerExtension gradleRunner = new ITGradleRunnerExtension(); | ||
|
||
@Test | ||
void k8sResource_whenRunOnWindows_generatesK8sSecretWithWindowsLineEndings() throws IOException, ParseException { | ||
// When | ||
final BuildResult result = gradleRunner.withITProject("secret-file").withArguments("k8sResource").build(); | ||
// Then | ||
ResourceVerify.verifyResourceDescriptors(gradleRunner.resolveDefaultKubernetesResourceFile(), | ||
gradleRunner.resolveFile("expected", "kubernetes_windows_line_endings.yml")); | ||
assertThat(result).extracting(BuildResult::getOutput).asString() | ||
.contains("Using resource templates from") | ||
.contains("Adding revision history limit to 2") | ||
.contains("validating"); | ||
} | ||
|
||
@Test | ||
void ocResource_whenRunOnWindows_generatesK8sSecretWithWindowsLineEndings() throws IOException, ParseException { | ||
// When | ||
final BuildResult result = gradleRunner.withITProject("secret-file").withArguments("ocResource").build(); | ||
// Then | ||
ResourceVerify.verifyResourceDescriptors(gradleRunner.resolveDefaultOpenShiftResourceFile(), | ||
gradleRunner.resolveFile("expected", "openshift_windows_line_endings.yml")); | ||
assertThat(result).extracting(BuildResult::getOutput).asString() | ||
.contains("Using resource templates from") | ||
.contains("Adding revision history limit to 2") | ||
.contains("validating"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters