Skip to content

Commit ddc4a5a

Browse files
committed
test: assert pipelinerunSpanContext propagates in new-model snapshot prep
Cover the carrier-annotation copy added in the preceding commit. The spec seeds the annotation on the build PipelineRun fixture, calls PrepareSnapshotForPipelineRun, asserts the same value lands on the resulting Snapshot, and cleans up to keep the shared fixture unchanged for subsequent specs. Assisted-by: Claude Code Signed-off-by: Josiah England <jengland@redhat.com>
1 parent 83be396 commit ddc4a5a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

snapshot/create_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,17 @@ var _ = Describe("Snapshot creation functions", Ordered, func() {
454454
Expect(label).To(Equal("pull_request"))
455455
})
456456

457+
It("propagates pipelinerunSpanContext annotation from the build PipelineRun to the Snapshot", func() {
458+
const carrier = `{"traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}`
459+
buildPipelineRun.Annotations[tektonconsts.SpanContextAnnotation] = carrier
460+
defer delete(buildPipelineRun.Annotations, tektonconsts.SpanContextAnnotation)
461+
462+
snapshot, err := PrepareSnapshotForPipelineRun(ctx, k8sClient, buildPipelineRun, componentName, hasCompGroup)
463+
Expect(err).ToNot(HaveOccurred())
464+
Expect(snapshot).ToNot(BeNil())
465+
Expect(snapshot.GetAnnotations()[tektonconsts.SpanContextAnnotation]).To(Equal(carrier))
466+
})
467+
457468
It("ensures non-pipelines as code labels and annotations are NOT propagated to the snapshot", func() {
458469
snapshot, err := PrepareSnapshotForPipelineRun(ctx, k8sClient, buildPipelineRun, componentName, hasCompGroup)
459470
Expect(err).ToNot(HaveOccurred())

0 commit comments

Comments
 (0)