@@ -15,7 +15,7 @@ import Testing
15
15
@testable import Valkey
16
16
17
17
#if DistributedTracingSupport
18
- @ testable import Instrumentation
18
+ import TracingTestKit
19
19
#endif
20
20
21
21
@Suite
@@ -491,7 +491,7 @@ struct ConnectionTests {
491
491
try await channel. close ( )
492
492
}
493
493
494
- #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
494
+ #if DistributedTracingSupport
495
495
@Suite
496
496
struct DistributedTracingTests {
497
497
@Test
@@ -514,11 +514,11 @@ struct ConnectionTests {
514
514
try await channel. writeInbound ( RESPToken ( . bulkString( " Bar " ) ) . base)
515
515
#expect( try await fooResult == " Bar " )
516
516
517
- #expect( tracer. spans . count == 1 )
518
- let span = try #require( tracer. spans . first)
517
+ #expect( tracer. finishedSpans . count == 1 )
518
+ let span = try #require( tracer. finishedSpans . first)
519
519
#expect( span. operationName == " GET " )
520
520
#expect( span. kind == . client)
521
- #expect( span. recordedErrors . isEmpty)
521
+ #expect( span. errors . isEmpty)
522
522
#expect(
523
523
span. attributes == [
524
524
" db.system.name " : " valkey " ,
@@ -528,7 +528,6 @@ struct ConnectionTests {
528
528
" network.peer.port " : 6379 ,
529
529
]
530
530
)
531
- #expect( span. recordedErrors. isEmpty)
532
531
#expect( span. status == nil )
533
532
}
534
533
@@ -556,13 +555,13 @@ struct ConnectionTests {
556
555
#expect( error. message == " ERR Error! " )
557
556
}
558
557
559
- #expect( tracer. spans . count == 1 )
560
- let span = try #require( tracer. spans . first)
558
+ #expect( tracer. finishedSpans . count == 1 )
559
+ let span = try #require( tracer. finishedSpans . first)
561
560
#expect( span. operationName == " GET " )
562
561
#expect( span. kind == . client)
563
- #expect( span. recordedErrors . count == 1 )
564
- let error = try #require( span. recordedErrors . first)
565
- #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
562
+ #expect( span. errors . count == 1 )
563
+ let error = try #require( span. errors . first)
564
+ #expect( error. error as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
566
565
#expect(
567
566
span. attributes == [
568
567
" db.system.name " : " valkey " ,
@@ -601,11 +600,11 @@ struct ConnectionTests {
601
600
602
601
#expect( try await results. 1 . get ( ) . map { String ( buffer: $0) } == " OK " )
603
602
604
- #expect( tracer. spans . count == 1 )
605
- let span = try #require( tracer. spans . first)
603
+ #expect( tracer. finishedSpans . count == 1 )
604
+ let span = try #require( tracer. finishedSpans . first)
606
605
#expect( span. operationName == " MULTI " )
607
606
#expect( span. kind == . client)
608
- #expect( span. recordedErrors . isEmpty)
607
+ #expect( span. errors . isEmpty)
609
608
#expect(
610
609
span. attributes == [
611
610
" db.system.name " : " valkey " ,
@@ -616,7 +615,6 @@ struct ConnectionTests {
616
615
" network.peer.port " : 6379 ,
617
616
]
618
617
)
619
- #expect( span. recordedErrors. isEmpty)
620
618
#expect( span. status == nil )
621
619
}
622
620
@@ -645,11 +643,11 @@ struct ConnectionTests {
645
643
646
644
#expect( try await results. 1 . get ( ) . map { String ( buffer: $0) } == " bar " )
647
645
648
- #expect( tracer. spans . count == 1 )
649
- let span = try #require( tracer. spans . first)
646
+ #expect( tracer. finishedSpans . count == 1 )
647
+ let span = try #require( tracer. finishedSpans . first)
650
648
#expect( span. operationName == " MULTI " )
651
649
#expect( span. kind == . client)
652
- #expect( span. recordedErrors . isEmpty)
650
+ #expect( span. errors . isEmpty)
653
651
#expect(
654
652
span. attributes == [
655
653
" db.system.name " : " valkey " ,
@@ -660,7 +658,6 @@ struct ConnectionTests {
660
658
" network.peer.port " : 6379 ,
661
659
]
662
660
)
663
- #expect( span. recordedErrors. isEmpty)
664
661
#expect( span. status == nil )
665
662
}
666
663
@@ -686,13 +683,13 @@ struct ConnectionTests {
686
683
try await channel. writeInbound ( RESPToken ( . simpleError( " WRONGTYPE Error! " ) ) . base)
687
684
_ = await results
688
685
689
- #expect( tracer. spans . count == 1 )
690
- let span = try #require( tracer. spans . first)
686
+ #expect( tracer. finishedSpans . count == 1 )
687
+ let span = try #require( tracer. finishedSpans . first)
691
688
#expect( span. operationName == " MULTI " )
692
689
#expect( span. kind == . client)
693
- #expect( span. recordedErrors . count == 1 )
694
- let error = try #require( span. recordedErrors . first)
695
- #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
690
+ #expect( span. errors . count == 1 )
691
+ let error = try #require( span. errors . first)
692
+ #expect( error. error as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
696
693
#expect(
697
694
span. attributes == [
698
695
" db.system.name " : " valkey " ,
0 commit comments