MartijnVisser commented on code in PR #29235:
URL: https://github.com/apache/flink/pull/29235#discussion_r4045548056
##########
flink-tests/src/test/java/org/apache/flink/test/misc/JobIDLoggingITCase.java:
##########
@@ -172,7 +172,8 @@ void testJobIDLogging(@InjectClusterClient ClusterClient<?>
clusterClient) throw
"Operator event.*",
"Recovered slot allocation snapshots.*",
".*heartbeat.*",
- ".*leadership.*");
+ ".*leadership.*",
+ "Freeing inactive slots.*");
Review Comment:
The same cleanup logs `Free slot with allocation id`, `Close JobManager
connection for job` and `Releasing job resources for job` under the other job's
MDC. I emitted those three and `testJobIDLogging` fails the same way.
##########
flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/util/JobIDLoggingUtil.java:
##########
@@ -66,18 +69,18 @@ public static void assertKeyPresent(
Arrays.stream(ignoredPatterns).map(Pattern::compile).collect(toList());
for (LogEvent e : ext.getEvents()) {
- ReadOnlyStringMap context = e.getContextData();
+ final String message = e.getMessage().getFormattedMessage();
+ if (matchesAny(ignorePatterns, message)) {
Review Comment:
This is only needed because `testEnrichedMdcLogging` shares the cluster. I
think giving it its own `MiniCluster` is the cleaner fix, and then you don't
need the new ignore pattern either.
##########
flink-test-utils-parent/flink-test-utils-junit/src/test/java/org/apache/flink/util/JobIDLoggingUtilTest.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.util;
+
+import org.apache.flink.testutils.logging.LoggerAuditingExtension;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.event.Level;
+
+import java.util.Collections;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link JobIDLoggingUtil}. */
+class JobIDLoggingUtilTest {
Review Comment:
There's no test for an ignore pattern that also matches one of the expected
events, which is exactly what this reordering changes. Can you add one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]