@@ -17,12 +17,12 @@ import NIOCore
1717import NIOEmbedded
1818import Testing
1919
20+ @testable import Valkey
21+
2022#if DistributedTracingSupport
2123@testable import Instrumentation
2224#endif
2325
24- @testable import Valkey
25-
2626@Suite
2727struct ConnectionTests {
2828
@@ -450,7 +450,7 @@ struct ConnectionTests {
450450 #expect( channel. isActive == true )
451451 }
452452
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
454454 @Suite ( . serialized)
455455 struct DistributedTracingTests {
456456 @Test
@@ -478,13 +478,15 @@ struct ConnectionTests {
478478 #expect( span. operationName == " GET " )
479479 #expect( span. kind == . client)
480480 #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+ )
488490 #expect( span. recordedErrors. isEmpty)
489491 #expect( span. status == nil )
490492 }
@@ -521,14 +523,16 @@ struct ConnectionTests {
521523 #expect( span. recordedErrors. count == 1 )
522524 let error = try #require( span. recordedErrors. first)
523525 #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+ )
532536 #expect( span. status? . code == . error)
533537 }
534538 }
@@ -563,14 +567,16 @@ struct ConnectionTests {
563567 #expect( span. operationName == " MULTI " )
564568 #expect( span. kind == . client)
565569 #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+ )
574580 #expect( span. recordedErrors. isEmpty)
575581 #expect( span. status == nil )
576582 }
@@ -606,14 +612,16 @@ struct ConnectionTests {
606612 #expect( span. operationName == " MULTI " )
607613 #expect( span. kind == . client)
608614 #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+ )
617625 #expect( span. recordedErrors. isEmpty)
618626 #expect( span. status == nil )
619627 }
@@ -648,14 +656,16 @@ struct ConnectionTests {
648656 #expect( span. recordedErrors. count == 1 )
649657 let error = try #require( span. recordedErrors. first)
650658 #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+ )
659669 #expect( span. status == nil )
660670 }
661671 }
0 commit comments