Skip to content
Closed
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 @@ -29,6 +29,7 @@

import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.AuthUtil;
Expand Down Expand Up @@ -64,7 +65,15 @@ public class TestUsersOperationsWithSecureHadoop {
private static String CLIENT_NAME;

@BeforeClass
public static void setUp() throws Exception {
public static void checkAndSetUp() throws Exception {
// check localhost kerberos users
Process process = Runtime.getRuntime().exec(new String[]{"bash", "-c", "klist"});
boolean wait = process.waitFor(2, TimeUnit.SECONDS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a simple assertTrue is sufficient for this case.

assertTrue("localhost exec klist timeout!", wait);
int ret = process.exitValue();
assertTrue("localhost have an existing ticket!",ret != 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about about assertNotEquals instead?

Copy link
Contributor Author

@WenFeiYi WenFeiYi Jun 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks. I commit on a new branch


// setup MiniKdc
KDC = TEST_UTIL.setupMiniKdc(KEYTAB_FILE);
PRINCIPAL = "hbase/" + HOST;
CLIENT_NAME = "foo";
Expand Down