This is an automated email from the ASF dual-hosted git repository.
slfan1989 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 59cbe803ca9 YARN-11933. TestAMSimulator fails due to shared node
labels store directory. (#8264) Contributed by Shilun Fan.
59cbe803ca9 is described below
commit 59cbe803ca9825bf6bc9f6a4b100703413dfa1a7
Author: slfan1989 <[email protected]>
AuthorDate: Mon Feb 23 12:20:48 2026 +0800
YARN-11933. TestAMSimulator fails due to shared node labels store
directory. (#8264) Contributed by Shilun Fan.
* YARN-11933. TestAMSimulator fails due to shared node labels store
directory.
Problem:
TestAMSimulator fails intermittently when running concurrently or
repeatedly due to shared Node Labels Store directory conflicts. Multiple test
instances write to the same default directory, causing interference and test
failures.
Root Case:
The test does not specify an independent Node Labels Store directory via
YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR
All test instances use the default shared path, leading to conflicts when:
1. Tests run in parallel
2. Multiple test executions overlap
3. Concurrent parameterized test cases execute
Solution:
Create isolated temporary directories for each test instance:
1. Setup phase: Create a unique temporary directory for Node Labels Store
and configure it via YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR
2. Teardown phase: Clean up the temporary directory to prevent resource
leaks
Reviewed-by: Chris Nauroth <[email protected]>
Signed-off-by: Shilun Fan <[email protected]>
---
.../hadoop/yarn/sls/appmaster/TestAMSimulator.java | 24 ++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git
a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java
b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java
index ffd518d43de..a4f4376c489 100644
---
a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java
+++
b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java
@@ -65,6 +65,7 @@ public class TestAMSimulator {
private ResourceManager rm;
private YarnConfiguration conf;
private Path metricOutputDir;
+ private Path nodeLabelsStoreDir;
private Class<?> slsScheduler;
private Class<?> scheduler;
@@ -76,14 +77,16 @@ public static Collection<Object[]> params() {
});
}
- public void initTestAMSimulator(Class<?> pSlsScheduler, Class<?> pScheduler)
{
+ public void initTestAMSimulator(Class<?> pSlsScheduler, Class<?> pScheduler)
+ throws IOException {
this.slsScheduler = pSlsScheduler;
this.scheduler = pScheduler;
setup();
}
- public void setup() {
+ public void setup() throws IOException {
createMetricOutputDir();
+ createNodeLabelsStoreDir();
conf = new YarnConfiguration();
conf.set(SLSConfiguration.METRICS_OUTPUT_DIR, metricOutputDir.toString());
@@ -91,6 +94,8 @@ public void setup() {
conf.set(SLSConfiguration.RM_SCHEDULER, scheduler.getName());
conf.set(YarnConfiguration.NODE_LABELS_ENABLED, "true");
conf.setBoolean(SLSConfiguration.METRICS_SWITCH, true);
+ conf.set(YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR,
+ nodeLabelsStoreDir.toUri().toString());
rm = new ResourceManager();
rm.init(conf);
rm.start();
@@ -141,6 +146,12 @@ private void createMetricOutputDir() {
}
}
+ private void createNodeLabelsStoreDir() throws IOException {
+ Path testDir =
+ Paths.get(System.getProperty("test.build.data", "target/test-dir"));
+ nodeLabelsStoreDir = Files.createTempDirectory(testDir, "node-labels");
+ }
+
private void deleteMetricOutputDir() {
try {
FileUtils.deleteDirectory(metricOutputDir.toFile());
@@ -149,6 +160,10 @@ private void deleteMetricOutputDir() {
}
}
+ private void deleteNodeLabelsStoreDir() throws IOException {
+ FileUtils.deleteDirectory(nodeLabelsStoreDir.toFile());
+ }
+
@ParameterizedTest
@MethodSource("params")
public void testAMSimulator(Class<?> pSlsScheduler, Class<?> pScheduler)
throws Exception {
@@ -231,7 +246,7 @@ public void testAMSimulatorWithNodeLabels(Class<?>
pSlsScheduler, Class<?> pSche
@ParameterizedTest
@MethodSource("params")
public void testPackageRequests(Class<?> pSlsScheduler, Class<?> pScheduler)
- throws YarnException {
+ throws YarnException, IOException {
initTestAMSimulator(pSlsScheduler, pScheduler);
MockAMSimulator app = new MockAMSimulator();
List<ContainerSimulator> containerSimulators = new ArrayList<>();
@@ -383,11 +398,12 @@ private TaskContainerDefinition
createDefaultTaskContainerDefMock(
}
@AfterEach
- public void tearDown() {
+ public void tearDown() throws IOException {
if (rm != null) {
rm.stop();
}
deleteMetricOutputDir();
+ deleteNodeLabelsStoreDir();
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]