@@ -21,7 +21,7 @@ import Testing
21
21
@testable import Valkey
22
22
23
23
#if DistributedTracingSupport
24
- @ testable import Instrumentation
24
+ import TracingTestKit
25
25
#endif
26
26
27
27
@Suite
@@ -497,7 +497,7 @@ struct ConnectionTests {
497
497
try await channel. close ( )
498
498
}
499
499
500
- #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
500
+ #if DistributedTracingSupport
501
501
@Suite
502
502
struct DistributedTracingTests {
503
503
@Test
@@ -520,11 +520,11 @@ struct ConnectionTests {
520
520
try await channel. writeInbound ( RESPToken ( . bulkString( " Bar " ) ) . base)
521
521
#expect( try await fooResult == " Bar " )
522
522
523
- #expect( tracer. spans . count == 1 )
524
- let span = try #require( tracer. spans . first)
523
+ #expect( tracer. finishedSpans . count == 1 )
524
+ let span = try #require( tracer. finishedSpans . first)
525
525
#expect( span. operationName == " GET " )
526
526
#expect( span. kind == . client)
527
- #expect( span. recordedErrors . isEmpty)
527
+ #expect( span. errors . isEmpty)
528
528
#expect(
529
529
span. attributes == [
530
530
" db.system.name " : " valkey " ,
@@ -534,7 +534,6 @@ struct ConnectionTests {
534
534
" network.peer.port " : 6379 ,
535
535
]
536
536
)
537
- #expect( span. recordedErrors. isEmpty)
538
537
#expect( span. status == nil )
539
538
}
540
539
@@ -562,13 +561,13 @@ struct ConnectionTests {
562
561
#expect( error. message == " ERR Error! " )
563
562
}
564
563
565
- #expect( tracer. spans . count == 1 )
566
- let span = try #require( tracer. spans . first)
564
+ #expect( tracer. finishedSpans . count == 1 )
565
+ let span = try #require( tracer. finishedSpans . first)
567
566
#expect( span. operationName == " GET " )
568
567
#expect( span. kind == . client)
569
- #expect( span. recordedErrors . count == 1 )
570
- let error = try #require( span. recordedErrors . first)
571
- #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
568
+ #expect( span. errors . count == 1 )
569
+ let error = try #require( span. errors . first)
570
+ #expect( error. error as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
572
571
#expect(
573
572
span. attributes == [
574
573
" db.system.name " : " valkey " ,
@@ -607,11 +606,11 @@ struct ConnectionTests {
607
606
608
607
#expect( try await results. 1 . get ( ) . map { String ( buffer: $0) } == " OK " )
609
608
610
- #expect( tracer. spans . count == 1 )
611
- let span = try #require( tracer. spans . first)
609
+ #expect( tracer. finishedSpans . count == 1 )
610
+ let span = try #require( tracer. finishedSpans . first)
612
611
#expect( span. operationName == " MULTI " )
613
612
#expect( span. kind == . client)
614
- #expect( span. recordedErrors . isEmpty)
613
+ #expect( span. errors . isEmpty)
615
614
#expect(
616
615
span. attributes == [
617
616
" db.system.name " : " valkey " ,
@@ -622,7 +621,6 @@ struct ConnectionTests {
622
621
" network.peer.port " : 6379 ,
623
622
]
624
623
)
625
- #expect( span. recordedErrors. isEmpty)
626
624
#expect( span. status == nil )
627
625
}
628
626
@@ -651,11 +649,11 @@ struct ConnectionTests {
651
649
652
650
#expect( try await results. 1 . get ( ) . map { String ( buffer: $0) } == " bar " )
653
651
654
- #expect( tracer. spans . count == 1 )
655
- let span = try #require( tracer. spans . first)
652
+ #expect( tracer. finishedSpans . count == 1 )
653
+ let span = try #require( tracer. finishedSpans . first)
656
654
#expect( span. operationName == " MULTI " )
657
655
#expect( span. kind == . client)
658
- #expect( span. recordedErrors . isEmpty)
656
+ #expect( span. errors . isEmpty)
659
657
#expect(
660
658
span. attributes == [
661
659
" db.system.name " : " valkey " ,
@@ -666,7 +664,6 @@ struct ConnectionTests {
666
664
" network.peer.port " : 6379 ,
667
665
]
668
666
)
669
- #expect( span. recordedErrors. isEmpty)
670
667
#expect( span. status == nil )
671
668
}
672
669
@@ -692,13 +689,13 @@ struct ConnectionTests {
692
689
try await channel. writeInbound ( RESPToken ( . simpleError( " WRONGTYPE Error! " ) ) . base)
693
690
_ = await results
694
691
695
- #expect( tracer. spans . count == 1 )
696
- let span = try #require( tracer. spans . first)
692
+ #expect( tracer. finishedSpans . count == 1 )
693
+ let span = try #require( tracer. finishedSpans . first)
697
694
#expect( span. operationName == " MULTI " )
698
695
#expect( span. kind == . client)
699
- #expect( span. recordedErrors . count == 1 )
700
- let error = try #require( span. recordedErrors . first)
701
- #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
696
+ #expect( span. errors . count == 1 )
697
+ let error = try #require( span. errors . first)
698
+ #expect( error. error as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
702
699
#expect(
703
700
span. attributes == [
704
701
" db.system.name " : " valkey " ,
0 commit comments