@@ -127,39 +127,50 @@ func (scope *scopeT) driverNamed(name string, opts ...ydb.Option) *ydb.Driver {
127127 connectionString := scope .ConnectionString ()
128128 scope .Logf ("Connect with connection string, driver name %q: %v" , name , connectionString )
129129
130- token := scope .AuthToken ()
131- if token == "" {
132- scope .Logf ("With empty auth token" )
133- opts = append (opts , ydb .WithAnonymousCredentials ())
134- } else {
135- scope .Logf ("With auth token" )
136- opts = append (opts , ydb .WithAccessTokenCredentials (token ))
137- }
138- cert := scope .CertFile ()
139- if cert == "" {
140- scope .Logf ("Without tls" )
141- opts = append (opts , ydb .WithTLSSInsecureSkipVerify ())
142- } else {
143- scope .Logf ("With tls" )
144- opts = append (opts , ydb .WithCertificatesFromFile (cert ))
145- }
130+ driver := scope .NonCachingDriver (opts ... )
146131
147- connectionContext , cancel := context .WithTimeout (scope .Ctx , time .Second * 10 )
148- defer cancel ()
149-
150- driver , err := ydb .Open (connectionContext , connectionString , opts ... )
151132 clean := func () {
152133 if driver != nil {
153134 scope .Require .NoError (driver .Close (scope .Ctx ))
154135 }
155136 }
156137
157- return fixenv .NewGenericResultWithCleanup (driver , clean ), err
138+ return fixenv .NewGenericResultWithCleanup (driver , clean ), nil
158139 }
159140
160141 return fixenv .CacheResult (scope .Env , f , fixenv.CacheOptions {CacheKey : name })
161142}
162143
144+ func (scope * scopeT ) NonCachingDriver (opts ... ydb.Option ) * ydb.Driver {
145+ connectionString := scope .ConnectionString ()
146+ scope .Logf ("Connect with connection string: %v" , connectionString )
147+
148+ token := scope .AuthToken ()
149+ if token == "" {
150+ scope .Logf ("With empty auth token" )
151+ opts = append (opts , ydb .WithAnonymousCredentials ())
152+ } else {
153+ scope .Logf ("With auth token" )
154+ opts = append (opts , ydb .WithAccessTokenCredentials (token ))
155+ }
156+ cert := scope .CertFile ()
157+ if cert == "" {
158+ scope .Logf ("Without tls" )
159+ opts = append (opts , ydb .WithTLSSInsecureSkipVerify ())
160+ } else {
161+ scope .Logf ("With tls" )
162+ opts = append (opts , ydb .WithCertificatesFromFile (cert ))
163+ }
164+
165+ connectionContext , cancel := context .WithTimeout (scope .Ctx , time .Second * 10 )
166+ defer cancel ()
167+
168+ driver , err := ydb .Open (connectionContext , connectionString , opts ... )
169+ scope .Require .NoError (err )
170+
171+ return driver
172+ }
173+
163174func (scope * scopeT ) SQLDriver (opts ... ydb.ConnectorOption ) * sql.DB {
164175 f := func () (* fixenv.GenericResult [* sql.DB ], error ) {
165176 driver := scope .Driver ()
0 commit comments