Skip to content

Commit c49d6ff

Browse files
committed
HADOOP-19617. Fix Junit Test.
1 parent 7a66020 commit c49d6ff

File tree

1 file changed

+9
-3
lines changed
  • hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server

1 file changed

+9
-3
lines changed

hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ public void testAggregation() throws Exception {
118118
kmsAudit.evictCacheForTesting();
119119
String out = getAndResetLogOutput();
120120
System.out.println(out);
121-
boolean doesMatch = out.matches(
121+
String cleanedOut =
122+
out.replaceAll("fs\\.default\\.name in core-default\\.xml is deprecated\\. " +
123+
"Instead, use fs\\.defaultFS", "");
124+
boolean doesMatch = cleanedOut.matches(
122125
"OK\\[op=DECRYPT_EEK, key=k1, user=luser@REALM, accessCount=1, "
123126
+ "interval=[^m]{1,4}ms\\] testmsg"
124127
// Not aggregated !!
@@ -156,11 +159,14 @@ public void testAggregationUnauth() throws Exception {
156159
kmsAudit.evictCacheForTesting();
157160
String out = getAndResetLogOutput();
158161
System.out.println(out);
162+
String cleanedOut =
163+
out.replaceAll("fs\\.default\\.name in core-default\\.xml is deprecated\\. " +
164+
"Instead, use fs\\.defaultFS", "");
159165

160166
// The UNAUTHORIZED will trigger cache invalidation, which then triggers
161167
// the aggregated OK (accessCount=5). But the order of the UNAUTHORIZED and
162168
// the aggregated OK is arbitrary - no correctness concerns, but flaky here.
163-
boolean doesMatch = out.matches(
169+
boolean doesMatch = cleanedOut.matches(
164170
"UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser@REALM\\] "
165171
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
166172
+ " interval=[^m]{1,4}ms\\] testmsg"
@@ -169,7 +175,7 @@ public void testAggregationUnauth() throws Exception {
169175
+ "UNAUTHORIZED\\[op=GENERATE_EEK, key=k3, user=luser@REALM\\] "
170176
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
171177
+ " interval=[^m]{1,4}ms\\] testmsg");
172-
doesMatch = doesMatch || out.matches(
178+
doesMatch = doesMatch || cleanedOut.matches(
173179
"UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser@REALM\\] "
174180
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
175181
+ " interval=[^m]{1,4}ms\\] testmsg"

0 commit comments

Comments
 (0)