zentol commented on a change in pull request #15279:
URL: https://github.com/apache/flink/pull/15279#discussion_r597497535
##########
File path:
flink-core/src/test/java/org/apache/flink/testutils/ThrowOnDoubleMemoryFreeing.java
##########
@@ -19,32 +19,28 @@
package org.apache.flink.testutils;
import org.apache.flink.core.memory.MemorySegment;
-import org.apache.flink.core.testutils.CommonTestUtils;
import org.apache.flink.util.ExternalResource;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.Properties;
/**
* A rule that can be used to enable throwing exception on multiple freeing of
{@link
* MemorySegment}.
*/
public class ThrowOnDoubleMemoryFreeing implements ExternalResource {
- private Map<String, String> systemEnv = new HashMap<>();
+ private Properties systemProperties;
@Override
public void before() throws Exception {
- systemEnv = System.getenv();
- CommonTestUtils.setEnv(
-
Collections.singletonMap(MemorySegment.CHECK_MULTIPLE_FREE_PROPERTY, ""),
false);
+ systemProperties = System.getProperties();
+ System.setProperty(MemorySegment.CHECK_MULTIPLE_FREE_PROPERTY, "");
Review comment:
does this approach actually work when running the test through maven?
Once the MemorySegment was loaded once without this property being set,
modifications to the property will have no effect.
it would be good to have a test that ensures this actually works as expected.
--
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:
[email protected]