yijut2 opened a new pull request, #23694: URL: https://github.com/apache/flink/pull/23694
## What is the purpose of the change This pull request fix the flaky-test testNodeAffinity() in InitTaskManagerDecoratorTest.java. (`flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/decorators/InitTaskManagerDecoratorTest.java`) ## Brief change log - **Test Failure** When applying Nondex to the test, the NodeSelectorRequirement object shows nondeterminism. When testing, we assume that requirement would be equal to expected_requirement, both of them are the instance of NodeSelectorRequirement object. The NodeSelectorRequirement object has three attributes, including key, operator, and values list. It is possible to get values list's elements in order `[blockedNode1, blockedNode2]`, while the expected result is `[blockedNode2, blockedNode1]` which is incorrect. - **Root Cause** The root cause appeared in line 56 of `KubernetesTaskManagerTestBase.java`. (flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/KubernetesTaskManagerTestBase.java) Here we define `BLOCKED_NODES` as a new `hashSet`. In `InitTaskManagerDecoratorTest.java`, when initializing the `expected_requirement` in the test, the values being passed was this`BLOCKED_NODES`, which is an **unordered Set**. Later, the code convert this **hashSet** into **arrayList**, which led to the unstable result of the values list. - **Command to reproduce the issue** `mvn -pl flink-kubernetes edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.apache.flink.kubernetes.kubeclient.decorators.InitTaskManagerDecoratorTest#testNodeAffinity` ## Verifying this change Please make sure both new and modified tests in this PR follows the conventions defined in our code quality guide: https://flink.apache.org/contributing/code-style-and-quality-common.html#testing *(Please pick either of the following options)* This change is to fix the test, it changes the test itself. This change can be verified as follows: - *Running the nondex for 100 times and passed all of them (NonDex is a tool for detecting and debugging wrong assumptions in Java)* ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no - The S3 file system connector: (yes / no / don't know) ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable -- 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]
