@@ -8,33 +8,35 @@ import io.github.resilience4j.retry.RetryConfig
88import reactor.core.publisher.ConnectableFlux
99import reactor.core.publisher.Flux
1010import reactor.core.scheduler.Schedulers
11-
11+ import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
1212import static datadog.trace.agent.test.utils.TraceUtils.runnableUnderTrace
13+ import spock.lang.RepeatUntilFailure
1314
1415class StackedOperatorsTest extends InstrumentationSpecification {
1516
17+ @RepeatUntilFailure (maxAttempts = 100 )
1618 def "test stacked operators retry (circuitbreaker )" () {
1719 setup:
1820 ConnectableFlux<String> connection = Flux
1921 .just(" abc" , " def " )
20- .map({ serviceCall(it)})
22+ .map({serviceCall(it)})
2123 .transformDeferred(CircuitBreakerOperator.of(CircuitBreaker.ofDefaults(" C2 " )))
2224 .transformDeferred(RetryOperator.of(Retry.of(" R1 " , RetryConfig.custom().maxAttempts(3).build())))
2325 .publishOn(Schedulers.boundedElastic())
2426 .publish()
2527
2628 when:
2729 connection.subscribe {
28- runnableUnderTrace (" child- " + it) {}
30+ runUnderTrace (" child- " + it, false ) {}
2931 }
3032
3133 runnableUnderTrace(" parent" , {
3234 connection.connect()
3335 })
3436
3537 then:
36- assertTraces(1 ) {
37- trace(6 ) {
38+ assertTraces(3 ) {
39+ trace(4 ) {
3840 sortSpansByStart()
3941 span(0) {
4042 operationName " parent"
@@ -56,14 +58,18 @@ class StackedOperatorsTest extends InstrumentationSpecification {
5658 childOf span(1)
5759 errored false
5860 }
59- span(4) {
61+ }
62+ trace(1) {
63+ span(0) {
6064 operationName " child- abc"
61- childOf span(1 )
65+ parent( )
6266 errored false
6367 }
64- span(5) {
68+ }
69+ trace(1) {
70+ span(0) {
6571 operationName " child- def "
66- childOf span(1 )
72+ parent( )
6773 errored false
6874 }
6975 }
0 commit comments