Skip to content

Commit 5bfa482

Browse files
committed
test(config): add tests for event.subscribe.enable and CLI --es override
1 parent 9d6027a commit 5bfa482

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

framework/src/test/java/org/tron/core/config/args/ArgsTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,31 @@ public void testCliOverridesStorageConfig() {
319319
Args.clearParam();
320320
}
321321

322+
/**
323+
* Verify that event.subscribe.enable from config is read correctly.
324+
* config-test.conf defines: event.subscribe.enable = true.
325+
*/
326+
@Test
327+
public void testEventSubscribeFromConfig() {
328+
Args.setParam(new String[] {}, TestConstants.TEST_CONF);
329+
Assert.assertTrue(Args.getInstance().isEventSubscribe());
330+
Args.clearParam();
331+
}
332+
333+
/**
334+
* Verify that CLI --es overrides event.subscribe.enable from config.
335+
* config-test.conf defines: event.subscribe.enable = true,
336+
* but --es is a boolean flag that defaults to false when not passed,
337+
* so passing --es explicitly sets eventSubscribe = true (same here).
338+
* The key point is that CLI assignment takes priority over config.
339+
*/
340+
@Test
341+
public void testCliEsOverridesConfig() {
342+
Args.setParam(new String[] {"--es"}, TestConstants.TEST_CONF);
343+
Assert.assertTrue(Args.getInstance().isEventSubscribe());
344+
Args.clearParam();
345+
}
346+
322347
/**
323348
* Verify that config file storage values are applied when no CLI override is present.
324349
*

framework/src/test/resources/config-test.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,8 @@ rate.limiter.http = [
382382
]
383383

384384
node.dynamicConfig.enable = true
385+
386+
event.subscribe = {
387+
enable = true
388+
}
385389
node.dynamicConfig.checkInterval = 0

0 commit comments

Comments
 (0)