@@ -84,9 +84,12 @@ public function testCliShortRunningTracingWhenEnabled()
8484 __DIR__ . '/scripts/synthetic.php ' ,
8585 [
8686 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
87- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
8887 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'true ' ,
89- ]
88+ ],
89+ [],
90+ '' ,
91+ false ,
92+ $ this ->untilNumberOfTraces (2 )
9093 );
9194
9295 $ this ->assertCount (2 , $ requests );
@@ -112,7 +115,6 @@ public function testAccessingTracerAfterForkIsUnproblematic()
112115 __DIR__ . '/scripts/access-tracer-after-fork.php ' ,
113116 [
114117 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
115- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
116118 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'true ' ,
117119 'DD_TRACE_DEBUG ' => 'false ' ,
118120 ],
@@ -137,9 +139,12 @@ public function testCliShortRunningMainSpanAreGenerateBeforeAndAfter()
137139 __DIR__ . '/scripts/short-running.php ' ,
138140 [
139141 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
140- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
141142 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'true ' ,
142- ]
143+ ],
144+ [],
145+ '' ,
146+ false ,
147+ $ this ->untilNumberOfTraces (2 )
143148 );
144149
145150 $ this ->assertCount (2 , $ requests );
@@ -165,9 +170,12 @@ public function testCliShortRunningMultipleForks()
165170 __DIR__ . '/scripts/short-running-multiple.php ' ,
166171 [
167172 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
168- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
169173 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'true ' ,
170- ]
174+ ],
175+ [],
176+ '' ,
177+ false ,
178+ $ this ->untilNumberOfTraces (6 )
171179 );
172180
173181 $ this ->assertCount (6 , $ requests );
@@ -204,7 +212,6 @@ public function testCliShortRunningMultipleNestedForks()
204212 __DIR__ . '/scripts/short-running-multiple-nested.php ' ,
205213 [
206214 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
207- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
208215 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'true ' ,
209216 ]
210217 );
@@ -238,32 +245,34 @@ public function testCliShortRunningMultipleNestedForks()
238245
239246 public function testCliLongRunningMultipleForksAutoFlush ()
240247 {
241- list ( $ requests ) = $ this ->inCli (
248+ $ this ->inCli (
242249 __DIR__ . '/scripts/long-running-autoflush.php ' ,
243250 [
244251 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
245252 'DD_TRACE_AUTO_FLUSH_ENABLED ' => 'true ' ,
246253 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'false ' ,
247- 'DD_TRACE_AGENT_FLUSH_INTERVAL ' => 0 ,
248- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
249- ]
250- );
251- $ this ->assertCount (4 , $ requests );
252-
253- for ($ i = 0 ; $ i < 4 ; $ i += 2 ) {
254- $ this ->assertFlameGraph ([$ requests [$ i ]], [
255- SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/ip ' ),
256- ]);
257-
258- $ this ->assertFlameGraph ([$ requests [$ i + 1 ]], [
259- SpanAssertion::exists ('long_running_entry_point ' )->withChildren ([
260- SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/get ' ),
261- SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/headers ' ),
262- SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/user-agent ' ),
254+ 'DD_TRACE_AGENT_FLUSH_INTERVAL ' => 333 ,
255+ ],
256+ [],
257+ '' ,
258+ false ,
259+ $ this ->until (
260+ $ this ->untilSpan (SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/child-0 ' )),
261+ $ this ->untilSpan (SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/child-1 ' )),
262+ $ this ->untilSpan (SpanAssertion::exists ('long_running_entry_point ' )->withChildren ([
263+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/entry_point-0 ' ),
264+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/main_process-0 ' ),
265+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/end_entry_point-0 ' ),
263266 SpanAssertion::exists ('pcntl_fork ' ),
264- ]),
265- ]);
266- }
267+ ])),
268+ $ this ->untilSpan (SpanAssertion::exists ('long_running_entry_point ' )->withChildren ([
269+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/entry_point-1 ' ),
270+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/main_process-1 ' ),
271+ SpanAssertion::exists ('curl_exec ' , '/httpbin_integration/end_entry_point-1 ' ),
272+ SpanAssertion::exists ('pcntl_fork ' ),
273+ ]))
274+ )
275+ );
267276 }
268277
269278 public function testCliLongRunningMultipleForksManualFlush ()
@@ -278,8 +287,11 @@ public function testCliLongRunningMultipleForksManualFlush()
278287 'DD_TRACE_CLI_ENABLED ' => 'true ' ,
279288 'DD_TRACE_AUTO_FLUSH_ENABLED ' => 'false ' ,
280289 'DD_TRACE_GENERATE_ROOT_SPAN ' => 'false ' ,
281- 'DD_TRACE_SHUTDOWN_TIMEOUT ' => 5000 ,
282- ]
290+ ],
291+ [],
292+ '' ,
293+ false ,
294+ $ this ->untilNumberOfTraces (6 )
283295 );
284296 $ this ->assertCount (6 , $ requests );
285297
0 commit comments