flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] rmetzger commented on a change in pull request #15108: [FLINK-21306] Ensure fatal errors always stop the JVM process
Date Tue, 23 Mar 2021 13:11:36 GMT

rmetzger commented on a change in pull request #15108:
URL: https://github.com/apache/flink/pull/15108#discussion_r599552923



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/util/FlinkSecurityManagerITCase.java
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.runtime.util;
+
+import org.apache.flink.configuration.ClusterOptions;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.security.FlinkSecurityManager;
+import org.apache.flink.runtime.testutils.TestJvmProcess;
+import org.apache.flink.util.OperatingSystem;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assume.assumeTrue;
+
+/** Integration tests for the {@link org.apache.flink.runtime.security.FlinkSecurityManager}.
*/
+public class FlinkSecurityManagerITCase extends TestLogger {
+
+    @Before
+    public void ensureSupportedOS() {
+        // based on the assumption in JvmExitOnFatalErrorTest, and manual testing on Mac,
we do not
+        // support all platforms (in particular not Windows)
+        assumeTrue(OperatingSystem.isLinux() || OperatingSystem.isMac());
+    }
+
+    // Test will run forever if JVM exit failed
+    @Test
+    public void testForcedJVMExit() throws Exception {
+        final ForcedJVMExitProcess testProcess =
+                new ForcedJVMExitProcess(ForcedExitEntryPoint.class);
+
+        try {
+            testProcess.startProcess();
+            testProcess.waitFor();
+            assertThat(testProcess.exitCode(), is(222));
+        } finally {
+            testProcess.destroy();
+        }
+    }
+
+    @Test
+    public void testIgnoredJVMExit() throws Exception {
+        final ForcedJVMExitProcess testProcess =
+                new ForcedJVMExitProcess(IgnoredExitEntryPoint.class);
+
+        try {
+            testProcess.startProcess();

Review comment:
       Indeed. But I don't understand what I should do about it, since the test will fail
anyways.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message