fix: fix ConfigChangeListener ut bug (#1663)

pull/1669/head
Fishtail 2 months ago committed by GitHub
parent 66b9d745da
commit 567ffe5fde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,3 +4,4 @@
- [fix:fix PolarisContextProperties instantiated twice causing NPE.](https://github.com/Tencent/spring-cloud-tencent/pull/1638)
- [feat: support tsf 2024.](https://github.com/Tencent/spring-cloud-tencent/pull/1635)
- [fix: fix ConfigChangeListener and unit test](https://github.com/Tencent/spring-cloud-tencent/pull/1657)
- [fix: fix ConfigChangeListener ut bug](https://github.com/Tencent/spring-cloud-tencent/pull/1663)

@ -57,7 +57,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
})
public class ConfigChangeListenerTest {
private static final CountDownLatch hits = new CountDownLatch(2);
private static CountDownLatch hits = new CountDownLatch(2);
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
@Autowired
@ -90,8 +90,10 @@ public class ConfigChangeListenerTest {
EnvironmentChangeEvent event = new EnvironmentChangeEvent(applicationContext, ketSet);
applicationEventPublisher.publishEvent(event);
//after change
//Reset hits for each iteration
boolean ret = hits.await(2, TimeUnit.SECONDS);
Assertions.assertThat(ret).isEqualTo(true);
hits = new CountDownLatch(2);
Assertions.assertThat(testConfig.getChangeCnt()).isEqualTo(2 * i - 2);
Assertions.assertThat(testConfig.getSyncChangeCnt()).isEqualTo(2 * i - 2);
Assertions.assertThat(testConfig.getTimeout()).isEqualTo(i * 1000);

Loading…
Cancel
Save