Skip to content

Commit aca2329

Browse files
authored
Mute some security tests on problematic JDK8 build (#75770)
This commit adds some `assumeFalse` (or modifies exising ones) to mute tests on JDK 1.8.0_292 due to JDK-8266279 On this JDK build, a race condition sometimes causes the PBEWithSHA1AndDESede algorithm to appear as though it is unavailable. Relates: #75571, #75417, #75379, #72639, #72359 Backport of: #75718
1 parent 84c3d03 commit aca2329

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

x-pack/plugin/security/cli/src/test/java/org/elasticsearch/xpack/security/cli/CertificateGenerateToolTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77

88
import com.google.common.jimfs.Configuration;
99
import com.google.common.jimfs.Jimfs;
10-
import org.bouncycastle.asn1.DLTaggedObject;
11-
import org.elasticsearch.bootstrap.JavaVersion;
12-
import org.elasticsearch.core.internal.io.IOUtils;
1310
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
1411
import org.bouncycastle.asn1.ASN1Sequence;
1512
import org.bouncycastle.asn1.ASN1String;
1613
import org.bouncycastle.asn1.DEROctetString;
14+
import org.bouncycastle.asn1.DLTaggedObject;
1715
import org.bouncycastle.asn1.pkcs.Attribute;
1816
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
1917
import org.bouncycastle.asn1.x509.Extension;
@@ -30,10 +28,13 @@
3028
import org.elasticsearch.common.io.PathUtils;
3129
import org.elasticsearch.common.network.NetworkAddress;
3230
import org.elasticsearch.common.settings.Settings;
31+
import org.elasticsearch.core.internal.io.IOUtils;
3332
import org.elasticsearch.env.Environment;
3433
import org.elasticsearch.env.TestEnvironment;
3534
import org.elasticsearch.test.ESTestCase;
3635
import org.elasticsearch.test.SecuritySettingsSourceField;
36+
import org.elasticsearch.xpack.core.ssl.CertParsingUtils;
37+
import org.elasticsearch.xpack.core.ssl.PemUtils;
3738
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.CAInfo;
3839
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.CertificateInformation;
3940
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.Name;
@@ -43,8 +44,6 @@
4344
import org.junit.After;
4445
import org.junit.BeforeClass;
4546

46-
import javax.security.auth.x500.X500Principal;
47-
4847
import java.io.IOException;
4948
import java.io.InputStream;
5049
import java.io.Reader;
@@ -74,6 +73,7 @@
7473
import java.util.Set;
7574
import java.util.function.Function;
7675
import java.util.stream.Collectors;
76+
import javax.security.auth.x500.X500Principal;
7777

7878
import static org.elasticsearch.test.TestMatchers.pathExists;
7979
import static org.hamcrest.Matchers.containsString;
@@ -265,7 +265,8 @@ public void testGeneratingCsr() throws Exception {
265265

266266
public void testGeneratingSignedCertificates() throws Exception {
267267
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72639",
268-
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
268+
"1.8.0_292".equals(System.getProperty("java.version")));
269+
269270
Path tempDir = initTempDir();
270271
Path outputFile = tempDir.resolve("out.zip");
271272
Path instanceFile = writeInstancesTo(tempDir.resolve("instances.yml"));

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlRealmTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.xpack.security.authc.support.UserRoleMapper;
3535
import org.hamcrest.Matchers;
3636
import org.junit.Before;
37+
import org.junit.BeforeClass;
3738
import org.mockito.Mockito;
3839
import org.opensaml.saml.common.xml.SAMLConstants;
3940
import org.opensaml.saml.metadata.resolver.impl.AbstractReloadingMetadataResolver;
@@ -105,6 +106,12 @@ public void setupEnv() throws PrivilegedActionException {
105106
threadContext = new ThreadContext(globalSettings);
106107
}
107108

109+
@BeforeClass
110+
public static void muteOnBrokenJdk() {
111+
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/75571",
112+
"1.8.0_292".equals(System.getProperty("java.version")));
113+
}
114+
108115
public void testReadIdpMetadataFromFile() throws Exception {
109116
final Path path = getDataPath("idp1.xml");
110117
Tuple<RealmConfig, SSLService> config = buildConfig(path.toString());

0 commit comments

Comments
 (0)