Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests mute impacted by JDK8 racy bug JDK-8266279 #72529

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
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
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