fix: fix ConfigChangeListener ut bug (#1659)

pull/1697/head
Fishtail 2 months ago committed by GitHub
parent 322f7f2f28
commit 2e5bb9f65a
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/1639)
- [fix: fix ConfigChangeListener and unit test](https://github.com/Tencent/spring-cloud-tencent/pull/1654)
- [feat: support spring-retry and feign config refresh and feign eager load support schema](https://github.com/Tencent/spring-cloud-tencent/pull/1649)
- [fix: fix ConfigChangeListener ut bug](https://github.com/Tencent/spring-cloud-tencent/pull/1659)

@ -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