@@ -17,12 +17,12 @@ import NIOCore
17
17
import NIOEmbedded
18
18
import Testing
19
19
20
+ @testable import Valkey
21
+
20
22
#if DistributedTracingSupport
21
23
@testable import Instrumentation
22
24
#endif
23
25
24
- @testable import Valkey
25
-
26
26
@Suite
27
27
struct ConnectionTests {
28
28
@@ -450,7 +450,7 @@ struct ConnectionTests {
450
450
#expect( channel. isActive == true )
451
451
}
452
452
453
- #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
453
+ #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
454
454
@Suite ( . serialized)
455
455
struct DistributedTracingTests {
456
456
@Test
@@ -478,13 +478,15 @@ struct ConnectionTests {
478
478
#expect( span. operationName == " GET " )
479
479
#expect( span. kind == . client)
480
480
#expect( span. recordedErrors. isEmpty)
481
- #expect( span. attributes == [
482
- " db.system.name " : " valkey " ,
483
- " db.operation.name " : " GET " ,
484
- " server.address " : " 127.0.0.1 " ,
485
- " network.peer.address " : " 127.0.0.1 " ,
486
- " network.peer.port " : 6379
487
- ] )
481
+ #expect(
482
+ span. attributes == [
483
+ " db.system.name " : " valkey " ,
484
+ " db.operation.name " : " GET " ,
485
+ " server.address " : " 127.0.0.1 " ,
486
+ " network.peer.address " : " 127.0.0.1 " ,
487
+ " network.peer.port " : 6379 ,
488
+ ]
489
+ )
488
490
#expect( span. recordedErrors. isEmpty)
489
491
#expect( span. status == nil )
490
492
}
@@ -521,14 +523,16 @@ struct ConnectionTests {
521
523
#expect( span. recordedErrors. count == 1 )
522
524
let error = try #require( span. recordedErrors. first)
523
525
#expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
524
- #expect( span. attributes == [
525
- " db.system.name " : " valkey " ,
526
- " db.operation.name " : " GET " ,
527
- " db.response.status_code " : " ERR " ,
528
- " server.address " : " 127.0.0.1 " ,
529
- " network.peer.address " : " 127.0.0.1 " ,
530
- " network.peer.port " : 6379
531
- ] )
526
+ #expect(
527
+ span. attributes == [
528
+ " db.system.name " : " valkey " ,
529
+ " db.operation.name " : " GET " ,
530
+ " db.response.status_code " : " ERR " ,
531
+ " server.address " : " 127.0.0.1 " ,
532
+ " network.peer.address " : " 127.0.0.1 " ,
533
+ " network.peer.port " : 6379 ,
534
+ ]
535
+ )
532
536
#expect( span. status? . code == . error)
533
537
}
534
538
}
@@ -563,14 +567,16 @@ struct ConnectionTests {
563
567
#expect( span. operationName == " MULTI " )
564
568
#expect( span. kind == . client)
565
569
#expect( span. recordedErrors. isEmpty)
566
- #expect( span. attributes == [
567
- " db.system.name " : " valkey " ,
568
- " db.operation.name " : " MULTI SET " ,
569
- " db.operation.batch.size " : 2 ,
570
- " server.address " : " 127.0.0.1 " ,
571
- " network.peer.address " : " 127.0.0.1 " ,
572
- " network.peer.port " : 6379
573
- ] )
570
+ #expect(
571
+ span. attributes == [
572
+ " db.system.name " : " valkey " ,
573
+ " db.operation.name " : " MULTI SET " ,
574
+ " db.operation.batch.size " : 2 ,
575
+ " server.address " : " 127.0.0.1 " ,
576
+ " network.peer.address " : " 127.0.0.1 " ,
577
+ " network.peer.port " : 6379 ,
578
+ ]
579
+ )
574
580
#expect( span. recordedErrors. isEmpty)
575
581
#expect( span. status == nil )
576
582
}
@@ -606,14 +612,16 @@ struct ConnectionTests {
606
612
#expect( span. operationName == " MULTI " )
607
613
#expect( span. kind == . client)
608
614
#expect( span. recordedErrors. isEmpty)
609
- #expect( span. attributes == [
610
- " db.system.name " : " valkey " ,
611
- " db.operation.name " : " MULTI " ,
612
- " db.operation.batch.size " : 2 ,
613
- " server.address " : " 127.0.0.1 " ,
614
- " network.peer.address " : " 127.0.0.1 " ,
615
- " network.peer.port " : 6379
616
- ] )
615
+ #expect(
616
+ span. attributes == [
617
+ " db.system.name " : " valkey " ,
618
+ " db.operation.name " : " MULTI " ,
619
+ " db.operation.batch.size " : 2 ,
620
+ " server.address " : " 127.0.0.1 " ,
621
+ " network.peer.address " : " 127.0.0.1 " ,
622
+ " network.peer.port " : 6379 ,
623
+ ]
624
+ )
617
625
#expect( span. recordedErrors. isEmpty)
618
626
#expect( span. status == nil )
619
627
}
@@ -648,14 +656,16 @@ struct ConnectionTests {
648
656
#expect( span. recordedErrors. count == 1 )
649
657
let error = try #require( span. recordedErrors. first)
650
658
#expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
651
- #expect( span. attributes == [
652
- " db.system.name " : " valkey " ,
653
- " db.operation.name " : " MULTI " ,
654
- " db.operation.batch.size " : 2 ,
655
- " server.address " : " 127.0.0.1 " ,
656
- " network.peer.address " : " 127.0.0.1 " ,
657
- " network.peer.port " : 6379
658
- ] )
659
+ #expect(
660
+ span. attributes == [
661
+ " db.system.name " : " valkey " ,
662
+ " db.operation.name " : " MULTI " ,
663
+ " db.operation.batch.size " : 2 ,
664
+ " server.address " : " 127.0.0.1 " ,
665
+ " network.peer.address " : " 127.0.0.1 " ,
666
+ " network.peer.port " : 6379 ,
667
+ ]
668
+ )
659
669
#expect( span. status == nil )
660
670
}
661
671
}
0 commit comments