From 03b6cc77f47e3460cff5ea1b9452cee09f2f2ca7 Mon Sep 17 00:00:00 2001 From: Slobodan Adamovic Date: Thu, 10 Apr 2025 17:45:32 +0200 Subject: [PATCH] [Test] Fix testGenerateMultipleCertificateWithNewCA Fixes an edge case where we randomly generate an empty list of key usages then pass it to `certutil` command. The empty means just apply the defaults, but we assert based on the generated empty set. Resolves https://github.com/elastic/elasticsearch/issues/126471 --- muted-tests.yml | 3 --- .../xpack/security/cli/HttpCertificateCommandTests.java | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index d1c342b0493a2..053a4806a0c5a 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -411,9 +411,6 @@ tests: - class: org.elasticsearch.xpack.test.rest.XPackRestIT method: test {p0=transform/transforms_start_stop/Test start/stop only starts/stops specified transform} issue: https://github.com/elastic/elasticsearch/issues/126466 -- class: org.elasticsearch.xpack.security.cli.HttpCertificateCommandTests - method: testGenerateMultipleCertificateWithNewCA - issue: https://github.com/elastic/elasticsearch/issues/126471 - class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT method: testILMDownsampleRollingRestart issue: https://github.com/elastic/elasticsearch/issues/126495 diff --git a/x-pack/plugin/security/cli/src/test/java/org/elasticsearch/xpack/security/cli/HttpCertificateCommandTests.java b/x-pack/plugin/security/cli/src/test/java/org/elasticsearch/xpack/security/cli/HttpCertificateCommandTests.java index 792796fea8c35..57ad76af3317a 100644 --- a/x-pack/plugin/security/cli/src/test/java/org/elasticsearch/xpack/security/cli/HttpCertificateCommandTests.java +++ b/x-pack/plugin/security/cli/src/test/java/org/elasticsearch/xpack/security/cli/HttpCertificateCommandTests.java @@ -380,7 +380,7 @@ public void testGenerateMultipleCertificateWithNewCA() throws Exception { caDN = "CN=" + randomAlphaOfLengthBetween(3, 8); caYears = randomIntBetween(1, 3); caKeySize = randomFrom(2048, 3072, 4096); - caKeyUsage = randomSubsetOf(CertGenUtils.KEY_USAGE_MAPPINGS.keySet()); + caKeyUsage = randomNonEmptySubsetOf(CertGenUtils.KEY_USAGE_MAPPINGS.keySet()); terminal.addTextInput(caDN); terminal.addTextInput(caYears + "y"); terminal.addTextInput(Integer.toString(caKeySize));