Skip to content

Commit

Permalink
[apache#722] revert the common/src/test/java/org/apache/uniffle/commo…
Browse files Browse the repository at this point in the history
…n/KerberizedHadoop.java
  • Loading branch information
cchung100m committed Aug 19, 2023
1 parent 193340d commit 9e6e6bc
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.net.BindException;
import java.net.ServerSocket;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -49,8 +51,6 @@
import org.apache.hadoop.security.authorize.AuthorizationException;
import org.apache.hadoop.security.authorize.ImpersonationProvider;
import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -78,6 +78,8 @@ public class KerberizedHadoop implements Serializable {

private MiniKdc kdc;
private File workDir;
private Path tempDir;
private Path kerberizedDfsBaseDir;

private MiniDFSCluster kerberizedDfsCluster;

Expand All @@ -92,16 +94,10 @@ public class KerberizedHadoop implements Serializable {
// krb5.conf file path
private String krb5ConfFile;

@TempDir File tempDir;
@TempDir File kerberizedDfsBaseDir;

@BeforeEach
void beforeEach() {
assertTrue(this.tempDir.isDirectory());
assertTrue(this.kerberizedDfsBaseDir.isDirectory());
}

protected void setup() throws Exception {
tempDir = Files.createTempDirectory("tempDir").toFile().toPath();
kerberizedDfsBaseDir = Files.createTempDirectory("kerberizedDfsBaseDir").toFile().toPath();
startKDC();
try {
startKerberizedDFS();
Expand Down Expand Up @@ -167,7 +163,7 @@ private Configuration createSecureDFSConfig() throws Exception {
CommonConfigurationKeysPublic.HADOOP_SECURITY_IMPERSONATION_PROVIDER_CLASS,
TestDummyImpersonationProvider.class.getName());

String keystoresDir = kerberizedDfsBaseDir.getAbsolutePath();
String keystoresDir = kerberizedDfsBaseDir.toFile().getAbsolutePath();
String sslConfDir = KeyStoreTestUtil.getClasspathDir(testRunnerCls);
KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);

Expand Down Expand Up @@ -232,8 +228,8 @@ private void startKDC() throws Exception {
kdcConf.setProperty(MiniKdc.ORG_DOMAIN, "COM");
kdcConf.setProperty(MiniKdc.KDC_BIND_ADDRESS, hostName);
kdcConf.setProperty(MiniKdc.KDC_PORT, "0");
workDir = tempDir;
kdc = new MiniKdc(kdcConf, tempDir);
workDir = tempDir.toFile();
kdc = new MiniKdc(kdcConf, workDir);
kdc.start();

krb5ConfFile = kdc.getKrb5conf().getAbsolutePath();
Expand Down

0 comments on commit 9e6e6bc

Please sign in to comment.