Skip to content

Commit 9b8359b

Browse files
YARN-9461. TestRMWebServicesDelegationTokenAuthentication.testCancelledDelegationToken fails with HTTP 400. Contributed by Peter Bacsko
1 parent 4456ea6 commit 9b8359b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesDelegationTokenAuthentication.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@
5959
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
6060
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo;
6161
import org.codehaus.jettison.json.JSONObject;
62+
import org.junit.After;
6263
import org.junit.AfterClass;
6364
import org.junit.Assert;
65+
import org.junit.Before;
6466
import org.junit.BeforeClass;
6567
import org.junit.Test;
6668

@@ -84,8 +86,8 @@ public class TestRMWebServicesDelegationTokenAuthentication {
8486

8587
private static boolean miniKDCStarted = false;
8688
private static MiniKdc testMiniKDC;
87-
private static MockRM rm;
8889
private static String sunSecurityKrb5RcacheValue;
90+
private MockRM rm;
8991

9092
String delegationTokenHeader;
9193

@@ -107,7 +109,7 @@ public static void setUp() {
107109
System.setProperty(SUN_SECURITY_KRB5_RCACHE_KEY, "none");
108110
testMiniKDC = new MiniKdc(MiniKdc.createConf(), testRootDir);
109111
setupKDC();
110-
setupAndStartRM();
112+
111113
} catch (Exception e) {
112114
assertTrue("Couldn't create MiniKDC", false);
113115
}
@@ -118,9 +120,6 @@ public static void tearDown() {
118120
if (testMiniKDC != null) {
119121
testMiniKDC.stop();
120122
}
121-
if (rm != null) {
122-
rm.stop();
123-
}
124123
if (sunSecurityKrb5RcacheValue == null) {
125124
System.clearProperty(SUN_SECURITY_KRB5_RCACHE_KEY);
126125
} else {
@@ -129,6 +128,18 @@ public static void tearDown() {
129128
}
130129
}
131130

131+
@Before
132+
public void before() throws Exception {
133+
setupAndStartRM();
134+
}
135+
136+
@After
137+
public void after() {
138+
if (rm != null) {
139+
rm.stop();
140+
}
141+
}
142+
132143
@Parameterized.Parameters
133144
public static Collection<Object[]> headers() {
134145
return Arrays.asList(new Object[][] { {OldDelegationTokenHeader}, {NewDelegationTokenHeader}});
@@ -139,7 +150,7 @@ public TestRMWebServicesDelegationTokenAuthentication(String header) throws Exce
139150
this.delegationTokenHeader = header;
140151
}
141152

142-
private static void setupAndStartRM() throws Exception {
153+
private void setupAndStartRM() throws Exception {
143154
Configuration rmconf = new Configuration();
144155
rmconf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
145156
YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);

0 commit comments

Comments
 (0)