diff --git a/CHANGELOG.md b/CHANGELOG.md index a1a64c2bac0..3a1e97f3e4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Bugs * Fix #5501: (crd-generator) Fix fallback value of `Default` annotation in presence of multiple accessors * Fix #5522: type inference fixed by bumping Sundrio to 0.101.2 (see https://github.com/sundrio/sundrio/pull/431) +* Fix #5554: move certificates in kubernetes-client-api to avoid collisions with those from mockwebserver #### Improvements diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java index f17111b9639..4f42b9632be 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java @@ -44,7 +44,7 @@ class CertUtilsTest { - private static final String FABRIC8_STORE_PATH = Utils.filePath(CertUtilsTest.class.getResource("/ssl/fabric8-store")); + private static final String FABRIC8_STORE_PATH = Utils.filePath(CertUtilsTest.class.getResource("/ssl-test/fabric8-store")); private static final String FABRIC8_STORE_PASSPHRASE = "fabric8"; private Properties systemProperties; @@ -76,7 +76,7 @@ void handleReadOnlyJavaTrustStore() throws Exception { KeyStore trustStore = Mockito.spy(system); Mockito.doThrow(KeyStoreException.class).when(trustStore).setCertificateEntry(Mockito.anyString(), Mockito.any()); KeyStore result = CertUtils.mergePemCertsIntoTrustStore( - CertUtils.getInputStreamFromDataOrFile(null, "src/test/resources/ssl/multiple-certs.pem"), trustStore, true); + CertUtils.getInputStreamFromDataOrFile(null, "src/test/resources/ssl-test/multiple-certs.pem"), trustStore, true); assertNotSame(trustStore, result); assertThat(Collections.list(result.aliases())) @@ -88,7 +88,7 @@ void handleReadOnlyJavaTrustStore() throws Exception { @Test void loadingMultipleCertsFromSameFile() throws Exception { KeyStore ts = CertUtils.createTrustStore( - null, "src/test/resources/ssl/multiple-certs.pem", null, "changeit"); + null, "src/test/resources/ssl-test/multiple-certs.pem", null, "changeit"); assertThat(Collections.list(ts.aliases())) .hasSizeGreaterThanOrEqualTo(2) @@ -99,7 +99,7 @@ void loadingMultipleCertsFromSameFile() throws Exception { @Test void loadingMultipleCertsWithSameSubjectFromSameFile() throws Exception { KeyStore ts = CertUtils.createTrustStore( - null, "src/test/resources/ssl/nonunique-subject.pem", null, "changeit"); + null, "src/test/resources/ssl-test/nonunique-subject.pem", null, "changeit"); assertTrue(ts.size() >= 2); } @@ -107,7 +107,7 @@ void loadingMultipleCertsWithSameSubjectFromSameFile() throws Exception { @Test void loadTrustStoreFromFileUsingConfigProperties() throws Exception { KeyStore trustStore = CertUtils.createTrustStore( - null, "src/test/resources/ssl/multiple-certs.pem", FABRIC8_STORE_PATH, FABRIC8_STORE_PASSPHRASE); + null, "src/test/resources/ssl-test/multiple-certs.pem", FABRIC8_STORE_PATH, FABRIC8_STORE_PASSPHRASE); assertThat(Collections.list(trustStore.aliases())) .hasSizeGreaterThanOrEqualTo(3) @@ -123,7 +123,7 @@ void loadTrustStoreFromFileUsingSystemProperties() throws Exception { System.setProperty("javax.net.ssl.trustStorePassword", FABRIC8_STORE_PASSPHRASE); KeyStore trustStore = CertUtils.createTrustStore( - null, "src/test/resources/ssl/multiple-certs.pem", null, null); + null, "src/test/resources/ssl-test/multiple-certs.pem", null, null); assertEquals(3, trustStore.size()); verifyFabric8InStore(trustStore); @@ -132,8 +132,8 @@ void loadTrustStoreFromFileUsingSystemProperties() throws Exception { @Test void loadKeyStoreFromFileUsingConfigProperties() throws Exception { KeyStore trustStore = CertUtils.createKeyStore( - null, "src/test/resources/ssl/multiple-certs.pem", - null, "src/test/resources/ssl/fabric8", "RSA", "changeit", + null, "src/test/resources/ssl-test/multiple-certs.pem", + null, "src/test/resources/ssl-test/fabric8", "RSA", "changeit", FABRIC8_STORE_PATH, FABRIC8_STORE_PASSPHRASE); assertEquals(2, trustStore.size()); @@ -145,8 +145,8 @@ void loadKeyStoreFromFileUsingSystemProperties() throws Exception { System.setProperty("javax.net.ssl.keyStore", FABRIC8_STORE_PATH); System.setProperty("javax.net.ssl.keyStorePassword", String.valueOf(FABRIC8_STORE_PASSPHRASE)); - String privateKeyPath = Utils.filePath(getClass().getResource("/ssl/fabric8")); - String multipleCertsPath = Utils.filePath(getClass().getResource("/ssl/multiple-certs.pem")); + String privateKeyPath = Utils.filePath(getClass().getResource("/ssl-test/fabric8")); + String multipleCertsPath = Utils.filePath(getClass().getResource("/ssl-test/multiple-certs.pem")); KeyStore trustStore = CertUtils.createKeyStore(null, multipleCertsPath, null, privateKeyPath, "RSA", "changeit", null, null); @@ -159,7 +159,7 @@ void loadKeyStoreFromFileUsingSystemProperties() throws Exception { void getInputStreamFromDataOrFileShouldNotDecodedPEMAgain() throws IOException { // Given File certFile = new File( - Objects.requireNonNull(getClass().getResource("/ssl/valid-non-base64-encoded-cert.pem")).getFile()); + Objects.requireNonNull(getClass().getResource("/ssl-test/valid-non-base64-encoded-cert.pem")).getFile()); String certData = new String(Files.readAllBytes(certFile.toPath())); // When @@ -188,7 +188,7 @@ void getInputStreamFromDataOrFileShouldDecodeBase64EncodedString() throws IOExce void storeKeyFallbacksToDefault() throws Exception { // When final KeyStore result = CertUtils.createTrustStore( - null, "src/test/resources/ssl/multiple-certs.pem", null, ""); + null, "src/test/resources/ssl-test/multiple-certs.pem", null, ""); // Then assertThat(Collections.list(result.aliases())) .hasSizeGreaterThanOrEqualTo(2) @@ -203,7 +203,7 @@ private void verifyFabric8InStore(KeyStore trustStore) assertNotNull(certificate); KeyStore storeWithCert = CertUtils.createTrustStore( - null, "src/test/resources/ssl/fabric8.crt", null, ""); + null, "src/test/resources/ssl-test/fabric8.crt", null, ""); String certificateAlias = storeWithCert.getCertificateAlias(certificate); assertNotNull(certificateAlias); } diff --git a/kubernetes-client-api/src/test/resources/ssl/fabric8 b/kubernetes-client-api/src/test/resources/ssl-test/fabric8 similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/fabric8 rename to kubernetes-client-api/src/test/resources/ssl-test/fabric8 diff --git a/kubernetes-client-api/src/test/resources/ssl/fabric8-store b/kubernetes-client-api/src/test/resources/ssl-test/fabric8-store similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/fabric8-store rename to kubernetes-client-api/src/test/resources/ssl-test/fabric8-store diff --git a/kubernetes-client-api/src/test/resources/ssl/fabric8.crt b/kubernetes-client-api/src/test/resources/ssl-test/fabric8.crt similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/fabric8.crt rename to kubernetes-client-api/src/test/resources/ssl-test/fabric8.crt diff --git a/kubernetes-client-api/src/test/resources/ssl/fabric8.csr b/kubernetes-client-api/src/test/resources/ssl-test/fabric8.csr similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/fabric8.csr rename to kubernetes-client-api/src/test/resources/ssl-test/fabric8.csr diff --git a/kubernetes-client-api/src/test/resources/ssl/fabric8.pub b/kubernetes-client-api/src/test/resources/ssl-test/fabric8.pub similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/fabric8.pub rename to kubernetes-client-api/src/test/resources/ssl-test/fabric8.pub diff --git a/kubernetes-client-api/src/test/resources/ssl/multiple-certs.pem b/kubernetes-client-api/src/test/resources/ssl-test/multiple-certs.pem similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/multiple-certs.pem rename to kubernetes-client-api/src/test/resources/ssl-test/multiple-certs.pem diff --git a/kubernetes-client-api/src/test/resources/ssl/nonunique-subject.pem b/kubernetes-client-api/src/test/resources/ssl-test/nonunique-subject.pem similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/nonunique-subject.pem rename to kubernetes-client-api/src/test/resources/ssl-test/nonunique-subject.pem diff --git a/kubernetes-client-api/src/test/resources/ssl/valid-non-base64-encoded-cert.pem b/kubernetes-client-api/src/test/resources/ssl-test/valid-non-base64-encoded-cert.pem similarity index 100% rename from kubernetes-client-api/src/test/resources/ssl/valid-non-base64-encoded-cert.pem rename to kubernetes-client-api/src/test/resources/ssl-test/valid-non-base64-encoded-cert.pem