Skip to content

Commit 977653c

Browse files
committed
Fix credential plugin policy test path on Windows
1 parent 746424b commit 977653c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎util/src/test/java/io/kubernetes/client/util/ExecCredentialPluginPolicyTest.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void lookPathIgnoresRelativeAndMissingEntries(@TempDir Path tempDir) throws IOEx
147147
}
148148

149149
@Test
150-
void kubeRcPolicies() {
150+
void kubeRcPolicies(@TempDir Path tempDir) {
151151
String header = "apiVersion: kubectl.config.k8s.io/v1beta1\nkind: Preference\n";
152152
assertThat(ExecCredentialPluginPolicy.fromKubeRc(new StringReader(header)))
153153
.isSameAs(ExecCredentialPluginPolicy.ALLOW_ALL);
@@ -164,17 +164,20 @@ void kubeRcPolicies() {
164164
new StringReader(header + "credentialPluginPolicy: DenyAll\n")))
165165
.isSameAs(ExecCredentialPluginPolicy.DENY_ALL);
166166

167+
String trustedBinary = tempDir.resolve("my-other-trusted-binary").toString();
167168
ExecCredentialPluginPolicy allowlist =
168169
ExecCredentialPluginPolicy.fromKubeRc(
169170
new StringReader(
170171
header
171172
+ "credentialPluginPolicy: Allowlist\n"
172173
+ "credentialPluginAllowlist:\n"
173174
+ " - command: my-trusted-binary\n"
174-
+ " - name: /usr/local/bin/my-other-trusted-binary\n"));
175+
+ " - name: "
176+
+ trustedBinary
177+
+ "\n"));
175178
assertThat(allowlist.getType()).isEqualTo(ExecCredentialPluginPolicy.PolicyType.ALLOWLIST);
176179
assertThat(allowlist.getAllowlist())
177-
.containsExactly("my-trusted-binary", "/usr/local/bin/my-other-trusted-binary");
180+
.containsExactly("my-trusted-binary", trustedBinary);
178181
}
179182

180183
@Test

0 commit comments

Comments
 (0)