@@ -18,12 +18,12 @@ import NIOEmbedded
1818import NIOPosix
1919import Testing
2020
21+ @testable import Valkey
22+
2123#if DistributedTracingSupport
2224@testable import Instrumentation
2325#endif
2426
25- @testable import Valkey
26-
2727@Suite
2828struct ConnectionTests {
2929
@@ -497,7 +497,7 @@ struct ConnectionTests {
497497 try await channel. close ( )
498498 }
499499
500- #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
500+ #if DistributedTracingSupport && compiler(>=6.2) // Swift Testing exit tests only added in 6.2
501501 @Suite ( . serialized)
502502 struct DistributedTracingTests {
503503 @Test
@@ -525,13 +525,15 @@ struct ConnectionTests {
525525 #expect( span. operationName == " GET " )
526526 #expect( span. kind == . client)
527527 #expect( span. recordedErrors. isEmpty)
528- #expect( span. attributes == [
529- " db.system.name " : " valkey " ,
530- " db.operation.name " : " GET " ,
531- " server.address " : " 127.0.0.1 " ,
532- " network.peer.address " : " 127.0.0.1 " ,
533- " network.peer.port " : 6379
534- ] )
528+ #expect(
529+ span. attributes == [
530+ " db.system.name " : " valkey " ,
531+ " db.operation.name " : " GET " ,
532+ " server.address " : " 127.0.0.1 " ,
533+ " network.peer.address " : " 127.0.0.1 " ,
534+ " network.peer.port " : 6379 ,
535+ ]
536+ )
535537 #expect( span. recordedErrors. isEmpty)
536538 #expect( span. status == nil )
537539 }
@@ -568,14 +570,16 @@ struct ConnectionTests {
568570 #expect( span. recordedErrors. count == 1 )
569571 let error = try #require( span. recordedErrors. first)
570572 #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " ERR Error! " ) )
571- #expect( span. attributes == [
572- " db.system.name " : " valkey " ,
573- " db.operation.name " : " GET " ,
574- " db.response.status_code " : " ERR " ,
575- " server.address " : " 127.0.0.1 " ,
576- " network.peer.address " : " 127.0.0.1 " ,
577- " network.peer.port " : 6379
578- ] )
573+ #expect(
574+ span. attributes == [
575+ " db.system.name " : " valkey " ,
576+ " db.operation.name " : " GET " ,
577+ " db.response.status_code " : " ERR " ,
578+ " server.address " : " 127.0.0.1 " ,
579+ " network.peer.address " : " 127.0.0.1 " ,
580+ " network.peer.port " : 6379 ,
581+ ]
582+ )
579583 #expect( span. status? . code == . error)
580584 }
581585 }
@@ -610,14 +614,16 @@ struct ConnectionTests {
610614 #expect( span. operationName == " MULTI " )
611615 #expect( span. kind == . client)
612616 #expect( span. recordedErrors. isEmpty)
613- #expect( span. attributes == [
614- " db.system.name " : " valkey " ,
615- " db.operation.name " : " MULTI SET " ,
616- " db.operation.batch.size " : 2 ,
617- " server.address " : " 127.0.0.1 " ,
618- " network.peer.address " : " 127.0.0.1 " ,
619- " network.peer.port " : 6379
620- ] )
617+ #expect(
618+ span. attributes == [
619+ " db.system.name " : " valkey " ,
620+ " db.operation.name " : " MULTI SET " ,
621+ " db.operation.batch.size " : 2 ,
622+ " server.address " : " 127.0.0.1 " ,
623+ " network.peer.address " : " 127.0.0.1 " ,
624+ " network.peer.port " : 6379 ,
625+ ]
626+ )
621627 #expect( span. recordedErrors. isEmpty)
622628 #expect( span. status == nil )
623629 }
@@ -653,14 +659,16 @@ struct ConnectionTests {
653659 #expect( span. operationName == " MULTI " )
654660 #expect( span. kind == . client)
655661 #expect( span. recordedErrors. isEmpty)
656- #expect( span. attributes == [
657- " db.system.name " : " valkey " ,
658- " db.operation.name " : " MULTI " ,
659- " db.operation.batch.size " : 2 ,
660- " server.address " : " 127.0.0.1 " ,
661- " network.peer.address " : " 127.0.0.1 " ,
662- " network.peer.port " : 6379
663- ] )
662+ #expect(
663+ span. attributes == [
664+ " db.system.name " : " valkey " ,
665+ " db.operation.name " : " MULTI " ,
666+ " db.operation.batch.size " : 2 ,
667+ " server.address " : " 127.0.0.1 " ,
668+ " network.peer.address " : " 127.0.0.1 " ,
669+ " network.peer.port " : 6379 ,
670+ ]
671+ )
664672 #expect( span. recordedErrors. isEmpty)
665673 #expect( span. status == nil )
666674 }
@@ -695,14 +703,16 @@ struct ConnectionTests {
695703 #expect( span. recordedErrors. count == 1 )
696704 let error = try #require( span. recordedErrors. first)
697705 #expect( error. 0 as? ValkeyClientError == ValkeyClientError ( . commandError, message: " WRONGTYPE Error! " ) )
698- #expect( span. attributes == [
699- " db.system.name " : " valkey " ,
700- " db.operation.name " : " MULTI " ,
701- " db.operation.batch.size " : 2 ,
702- " server.address " : " 127.0.0.1 " ,
703- " network.peer.address " : " 127.0.0.1 " ,
704- " network.peer.port " : 6379
705- ] )
706+ #expect(
707+ span. attributes == [
708+ " db.system.name " : " valkey " ,
709+ " db.operation.name " : " MULTI " ,
710+ " db.operation.batch.size " : 2 ,
711+ " server.address " : " 127.0.0.1 " ,
712+ " network.peer.address " : " 127.0.0.1 " ,
713+ " network.peer.port " : 6379 ,
714+ ]
715+ )
706716 #expect( span. status == nil )
707717 }
708718 }
0 commit comments