Skip to content

Commit

Permalink
rocketmq禁消费集成测试脚本test-16
Browse files Browse the repository at this point in the history
Signed-off-by: daizhenyu <[email protected]>
  • Loading branch information
daizhenyu committed Jan 12, 2024
1 parent b8820f0 commit 07b138c
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ public class RocketMqProhibitionTest {
@EnabledIfSystemProperty(named = "mq.consume.prohibition.integration.test.type", matches = "ROCKETMQ_ONE_TOPIC")
public void testRocketMqOneTopic() throws Exception {
// 下发禁止消费配置
String config = "enableRocketMqProhibition: true" + lineSeparator +
String configOn = "enableRocketMqProhibition: true" + lineSeparator +
"rocketMqTopics:" + lineSeparator +
" - topic-push-1" + lineSeparator +
" - topic-pull-subscribe-1" + lineSeparator +
" - topic-pull-assign-1";
DynamicConfigUtils.updateConfig(config);
String configOff = "enableRocketMqProhibition: false" + lineSeparator +
"rocketMqTopics:" + lineSeparator +
" - topic-push-1" + lineSeparator +
" - topic-pull-subscribe-1" + lineSeparator +
" - topic-pull-assign-1";
DynamicConfigUtils.updateConfig(configOn);

// 等待动态配置生效
Thread.sleep(3000);
Expand All @@ -70,8 +75,7 @@ public void testRocketMqOneTopic() throws Exception {
Assertions.assertEquals("0", HttpRequestUtils.doGet("http://127.0.0.1:9056/messageQueue"));

// 消费者开启消费
config = "";
DynamicConfigUtils.updateConfig(config);
DynamicConfigUtils.updateConfig(configOff);

// 等待动态配置生效
Thread.sleep(25000);
Expand All @@ -84,12 +88,7 @@ public void testRocketMqOneTopic() throws Exception {
Assertions.assertEquals("4", HttpRequestUtils.doGet("http://127.0.0.1:9056/messageQueue"));

// 运行时禁止消费,下发禁止消费配置
config = "enableRocketMqProhibition: true" + lineSeparator +
"rocketMqTopics:" + lineSeparator +
" - topic-push-1" + lineSeparator +
" - topic-pull-subscribe-1" + lineSeparator +
" - topic-pull-assign-1";
DynamicConfigUtils.updateConfig(config);
DynamicConfigUtils.updateConfig(configOn);

// 等待动态配置生效
Thread.sleep(10000);
Expand Down

0 comments on commit 07b138c

Please sign in to comment.