Skip to content

Commit 2cb81e1

Browse files
committed
test(ffe): fix span-enrichment .phpt for pecl + concurrent roots
Skip the src/-dependent tests in the PECL package (src/ isn't shipped there, matching system_test_data_evaluate). Rebuild the concurrent-roots test with start_trace_span() — create_stack() inherits the parent trace's root, so both stacks shared one root; start_trace_span() creates a genuinely independent root.
1 parent 2b92832 commit 2cb81e1

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

tests/ext/ffe/span_enrichment_concurrent_roots.phpt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
--TEST--
22
FFE span enrichment: concurrently-open root spans each keep their own tags
3+
--SKIPIF--
4+
<?php
5+
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6+
die('skip: the src/ PHP API is not shipped in the PECL test package');
7+
}
8+
?>
39
--INI--
410
datadog.trace.generate_root_span=0
511
datadog.experimental_flagging_provider_span_enrichment_enabled=1
@@ -34,16 +40,14 @@ function show($label, $value) {
3440

3541
$codec = new SpanEnrichmentAccumulator();
3642

37-
// Root A on the initial stack.
38-
\DDTrace\start_span();
39-
$rootA = \DDTrace\root_span();
43+
// Trace A: start_trace_span() creates a NEW root span on its own stack.
44+
$rootA = \DDTrace\start_trace_span();
4045
$a = new EvaluationDetails('on', EvaluationType::STRING, EvaluationReason::SPLIT, 'a', null, null, array(), array('serialId' => 100, 'doLog' => false));
4146
SpanEnrichmentRegistry::record('flag.a', $a, null);
4247

43-
// Root B on a second, independent stack (models concurrent roots / fibers).
44-
\DDTrace\create_stack();
45-
\DDTrace\start_span();
46-
$rootB = \DDTrace\root_span();
48+
// Trace B: a second, concurrently-open root on its own stack (A stays open
49+
// underneath). Models the fibers / multiple-span-stacks case.
50+
$rootB = \DDTrace\start_trace_span();
4751
$b = new EvaluationDetails('off', EvaluationType::STRING, EvaluationReason::SPLIT, 'b', null, null, array(), array('serialId' => 200, 'doLog' => false));
4852
SpanEnrichmentRegistry::record('flag.b', $b, null);
4953

tests/ext/ffe/span_enrichment_gate_off.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
--TEST--
22
FFE span enrichment: gate off writes no ffe_* tags onto the root span
3+
--SKIPIF--
4+
<?php
5+
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6+
die('skip: the src/ PHP API is not shipped in the PECL test package');
7+
}
8+
?>
39
--INI--
410
datadog.experimental_flagging_provider_span_enrichment_enabled=0
511
--FILE--

tests/ext/ffe/span_enrichment_root_meta.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
--TEST--
22
FFE span enrichment: evaluations aggregate onto the active root span's meta
3+
--SKIPIF--
4+
<?php
5+
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6+
die('skip: the src/ PHP API is not shipped in the PECL test package');
7+
}
8+
?>
39
--INI--
410
datadog.experimental_flagging_provider_span_enrichment_enabled=1
511
--FILE--

0 commit comments

Comments
 (0)