spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
701 stars 697 forks source link

Fix flaky test: LifecycleMvcAutoConfigurationTests.environmentWebEndpointExtensionEnabled #1362

Open OlgaMaciaszek opened 1 month ago

OlgaMaciaszek commented 1 month ago

https://github.com/spring-cloud/spring-cloud-commons/actions/runs/9941908937/job/27462194088

Occured after merging: https://github.com/spring-cloud/spring-cloud-commons/commit/4e6540b2b045a8abddc876265cf0373e1bee32bd

spencergibb commented 2 weeks ago

I don't think it's a flaky test. After upgrading to boot 3.4 it fails consistently. The flaky nature was probably due to compatibility tests or something.

spencergibb commented 2 weeks ago

Also resumeEndpointGloballyDisabled after disabling environmentWebEndpointExtensionEnabled

hpoettker commented 2 weeks ago

I had a look after it failed when #1361 was merged. The problem is restartEndpointEnabled, which runs before environmentWebEndpointExtensionEnabled. When I run all tests of the class in my IDE a couple of times, I can reproduce it eventually.

The test triggers a context restart in a separate thread, and the test doesn't wait for that to finish. The subsequent test then gets ConcurrentModificationException as the logging bootstrappings get in the way of each other.