Skip to content

Commit 4757870

Browse files
authored
Enable krb5kdc-fixture, kerberos tests mount urandom for kdc container (#41710)
Infra has fixed #10462 by installing `haveged` on CI workers. This commit enables the disabled fixture and tests, and mounts `/dev/urandom` for the container so there is enough entropy required for kdc. Note: hdfs-repository tests have been disabled, will raise a separate issue for it. Closes #40624 Closes #40678
1 parent 6708639 commit 4757870

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

plugins/repository-hdfs/build.gradle

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
8787
// the hdfs.MiniHDFS fixture writes the ports file when
8888
// it's ready, so we can just wait for the file to exist
8989
return fixture.portsFile.exists()
90-
}
90+
}
9191

9292
final List<String> miniHDFSArgs = []
9393

@@ -116,20 +116,29 @@ for (String fixtureName : ['hdfsFixture', 'haHdfsFixture', 'secureHdfsFixture',
116116
}
117117
}
118118

119+
Set disabledIntegTestTaskNames = ['integTestSecure', 'integTestSecureHa']
120+
119121
for (String integTestTaskName : ['integTestHa', 'integTestSecure', 'integTestSecureHa']) {
120122
task "${integTestTaskName}"(type: RestIntegTestTask) {
121123
description = "Runs rest tests against an elasticsearch cluster with HDFS."
122124
dependsOn(project.bundlePlugin)
125+
126+
if (disabledIntegTestTaskNames.contains(integTestTaskName)) {
127+
enabled = false;
128+
}
129+
123130
runner {
124131
if (integTestTaskName.contains("Secure")) {
125-
dependsOn secureHdfsFixture
126-
systemProperty "test.krb5.principal.es", "elasticsearch@${realm}"
127-
systemProperty "test.krb5.principal.hdfs", "hdfs/hdfs.build.elastic.co@${realm}"
128-
jvmArgs "-Djava.security.krb5.conf=${krb5conf}"
129-
systemProperty (
130-
"test.krb5.keytab.hdfs",
131-
project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs","hdfs_hdfs.build.elastic.co.keytab")
132-
)
132+
if (disabledIntegTestTaskNames.contains(integTestTaskName) == false) {
133+
dependsOn secureHdfsFixture
134+
nonInputProperties.systemProperty "test.krb5.principal.es", "elasticsearch@${realm}"
135+
nonInputProperties.systemProperty "test.krb5.principal.hdfs", "hdfs/hdfs.build.elastic.co@${realm}"
136+
jvmArgs "-Djava.security.krb5.conf=${krb5conf}"
137+
nonInputProperties.systemProperty (
138+
"test.krb5.keytab.hdfs",
139+
project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs","hdfs_hdfs.build.elastic.co.keytab")
140+
)
141+
}
133142
}
134143
}
135144
}

test/fixtures/hdfs-fixture/src/main/java/hdfs/MiniHDFS.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,6 @@
1919

2020
package hdfs;
2121

22-
import java.io.File;
23-
import java.lang.management.ManagementFactory;
24-
import java.net.URL;
25-
import java.nio.charset.StandardCharsets;
26-
import java.nio.file.Files;
27-
import java.nio.file.Path;
28-
import java.nio.file.Paths;
29-
import java.nio.file.StandardCopyOption;
30-
import java.util.ArrayList;
31-
import java.util.Arrays;
32-
import java.util.List;
33-
3422
import org.apache.commons.io.FileUtils;
3523
import org.apache.hadoop.conf.Configuration;
3624
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
@@ -45,6 +33,18 @@
4533
import org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil;
4634
import org.apache.hadoop.security.UserGroupInformation;
4735

36+
import java.io.File;
37+
import java.lang.management.ManagementFactory;
38+
import java.net.URL;
39+
import java.nio.charset.StandardCharsets;
40+
import java.nio.file.Files;
41+
import java.nio.file.Path;
42+
import java.nio.file.Paths;
43+
import java.nio.file.StandardCopyOption;
44+
import java.util.ArrayList;
45+
import java.util.Arrays;
46+
import java.util.List;
47+
4848
/**
4949
* MiniHDFS test fixture. There is a CLI tool, but here we can
5050
* easily properly setup logging, avoid parsing JSON, etc.
@@ -174,4 +174,5 @@ public static void main(String[] args) throws Exception {
174174
Files.write(tmp, portFileContent.getBytes(StandardCharsets.UTF_8));
175175
Files.move(tmp, baseDir.resolve(PORT_FILE_NAME), StandardCopyOption.ATOMIC_MOVE);
176176
}
177+
177178
}

test/fixtures/krb5kdc-fixture/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ postProcessFixture {
4747
}
4848
}
4949

50-
// https://github.com/elastic/elasticsearch/issues/40624
51-
buildFixture.enabled = false
50+
buildFixture.enabled = true
5251

5352
project.ext.krb5Conf = { service -> file("$buildDir/shared/${service}/krb5.conf") }
5453
project.ext.krb5Keytabs = { service, fileName -> file("$buildDir/shared/${service}/keytabs/${fileName}") }

test/fixtures/krb5kdc-fixture/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ services:
88
command: "bash /fixture/src/main/resources/provision/peppa.sh"
99
volumes:
1010
- ./build/shared/peppa:/fixture/build
11+
# containers have bad entropy so mount /dev/urandom. Less secure but this is a test fixture.
12+
- /dev/urandom:/dev/random
1113
ports:
1214
- "4444"
1315
- "88/udp"
@@ -19,6 +21,8 @@ services:
1921
command: "bash /fixture/src/main/resources/provision/hdfs.sh"
2022
volumes:
2123
- ./build/shared/hdfs:/fixture/build
24+
# containers have bad entropy so mount /dev/urandom. Less secure but this is a test fixture.
25+
- /dev/urandom:/dev/random
2226
ports:
2327
- "4444"
2428
- "88/udp"

x-pack/qa/kerberos-tests/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ apply plugin: 'elasticsearch.test.fixtures'
88

99
testFixtures.useFixture ":test:fixtures:krb5kdc-fixture"
1010

11-
// https://github.com/elastic/elasticsearch/issues/40624
12-
integTest.enabled = false
11+
integTest.enabled = true
1312

1413
dependencies {
1514
testCompile project(':x-pack:plugin:core')
@@ -59,9 +58,9 @@ integTestCluster {
5958
String realm = "BUILD.ELASTIC.CO"
6059
integTestRunner {
6160
Path peppaKeytab = Paths.get("${project.buildDir}", "generated-resources", "keytabs", "peppa.keytab")
62-
systemProperty 'test.userkt', "peppa@${realm}"
63-
systemProperty 'test.userkt.keytab', "${peppaKeytab}"
64-
systemProperty 'test.userpwd', "george@${realm}"
61+
nonInputProperties.systemProperty 'test.userkt', "peppa@${realm}"
62+
nonInputProperties.systemProperty 'test.userkt.keytab', "${peppaKeytab}"
63+
nonInputProperties.systemProperty 'test.userpwd', "george@${realm}"
6564
systemProperty 'test.userpwd.password', "dino"
6665
systemProperty 'tests.security.manager', 'true'
6766
jvmArgs([

0 commit comments

Comments
 (0)