Skip to content

Commit

Permalink
Tests mute impacted by JDK8 racy bug JDK-8266279 (#72359)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertzaharovits authored Apr 30, 2021
1 parent 54da625 commit 47d0699
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.bouncycastle.openssl.PEMEncryptedKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.cli.MockTerminal;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.cli.UserException;
Expand Down Expand Up @@ -558,6 +559,8 @@ public void testNameValues() throws Exception {
* - Checks that all 3 certificates have the right values based on the command line options provided during generation
*/
public void testCreateCaAndMultipleInstances() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
final Path tempDir = initTempDir();

final Terminal terminal = new MockTerminal();
Expand Down Expand Up @@ -707,6 +710,8 @@ Path resolveOutputPath(Terminal terminal, OptionSet options, String defaultFilen
* - Checks that the PKCS12 certificate and the PEM certificate trust one another
*/
public void testTrustBetweenPEMandPKCS12() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
final Path tempDir = initTempDir();

final MockTerminal terminal = new MockTerminal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemReader;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.cli.MockTerminal;
import org.elasticsearch.common.CheckedBiFunction;
import org.elasticsearch.common.CheckedFunction;
Expand Down Expand Up @@ -116,6 +117,9 @@ public static void muteInFips() {
}

public void testGenerateSingleCertificateSigningRequest() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);

final Path outFile = testRoot.resolve("csr.zip").toAbsolutePath();

final List<String> hostNames = randomHostNames();
Expand Down Expand Up @@ -216,6 +220,8 @@ public void testGenerateSingleCertificateSigningRequest() throws Exception {
}

public void testGenerateSingleCertificateWithExistingCA() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
final Path outFile = testRoot.resolve("certs.zip").toAbsolutePath();

final List<String> hostNames = randomHostNames();
Expand Down Expand Up @@ -329,6 +335,8 @@ public void testGenerateSingleCertificateWithExistingCA() throws Exception {
}

public void testGenerateMultipleCertificateWithNewCA() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
final Path outFile = testRoot.resolve("certs.zip").toAbsolutePath();

final int numberCerts = randomIntBetween(3, 6);
Expand Down Expand Up @@ -470,6 +478,8 @@ public void testGenerateMultipleCertificateWithNewCA() throws Exception {
}

public void testParsingValidityPeriod() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
final HttpCertificateCommand command = new HttpCertificateCommand();
final MockTerminal terminal = new MockTerminal();

Expand Down Expand Up @@ -523,6 +533,8 @@ public void testParsingValidityPeriod() throws Exception {
}

public void testValidityPeriodToString() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
assertThat(HttpCertificateCommand.toString(Period.ofYears(2)), is("2y"));
assertThat(HttpCertificateCommand.toString(Period.ofMonths(5)), is("5m"));
assertThat(HttpCertificateCommand.toString(Period.ofDays(60)), is("60d"));
Expand All @@ -536,6 +548,8 @@ public void testValidityPeriodToString() throws Exception {
}

public void testGuessFileType() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
MockTerminal terminal = new MockTerminal();

final Path caCert = getDataPath("ca.crt");
Expand Down Expand Up @@ -563,6 +577,8 @@ public void testGuessFileType() throws Exception {
}

public void testTextFileSubstitutions() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72359",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
CheckedBiFunction<String, Map<String, String>, String, Exception> copy = (source, subs) -> {
try (InputStream in = new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8));
StringWriter out = new StringWriter();
Expand Down

0 comments on commit 47d0699

Please sign in to comment.