@@ -259,49 +259,98 @@ func TestDriver(sourceTest *testing.T) {
259259 })
260260 t .RunSynced ("UsingExplicitStaticCredentials" , func (t * xtest.SyncedTest ) {
261261 t .RunSynced ("HappyWay" , func (t * xtest.SyncedTest ) {
262- db , err := ydb .Open (ctx ,
263- os .Getenv ("YDB_CONNECTION_STRING" ),
264- ydb .WithStaticCredentials ("test" , "password" ),
265- )
266- require .NoError (t , err )
267- defer func () {
268- _ = db .Close (ctx )
269- }()
270- tableName := path .Join (db .Name (), t .Name (), "test" )
271- t .RunSynced ("CreateTable" , func (t * xtest.SyncedTest ) {
272- err := db .Query ().Exec (ctx , fmt .Sprintf (`
262+ t .RunSynced ("WithStaticCredentials" , func (t * xtest.SyncedTest ) {
263+ db , err := ydb .Open (ctx ,
264+ os .Getenv ("YDB_CONNECTION_STRING" ),
265+ ydb .WithStaticCredentials ("test" , "password" ),
266+ )
267+ require .NoError (t , err )
268+ defer func () {
269+ _ = db .Close (ctx )
270+ }()
271+ tableName := path .Join (db .Name (), t .Name (), "test" )
272+ t .RunSynced ("CreateTable" , func (t * xtest.SyncedTest ) {
273+ err := db .Query ().Exec (ctx , fmt .Sprintf (`
274+ CREATE TABLE IF NOT EXISTS %s (
275+ id Uint64,
276+ value Utf8,
277+ PRIMARY KEY (id)
278+ )` , "`" + tableName + "`" ),
279+ )
280+ require .NoError (t , err )
281+ })
282+ t .RunSynced ("Query" , func (t * xtest.SyncedTest ) {
283+ row , err := db .Query ().QueryRow (ctx , `SELECT 1` )
284+ require .NoError (t , err )
285+ var v int
286+ err = row .Scan (& v )
287+ require .NoError (t , err )
288+ })
289+ t .RunSynced ("DescribeTable" , func (t * xtest.SyncedTest ) {
290+ var d options.Description
291+ err := db .Table ().Do (ctx , func (ctx context.Context , s table.Session ) error {
292+ d , err = s .DescribeTable (ctx , tableName )
293+ if err != nil {
294+ return err
295+ }
296+
297+ return nil
298+ })
299+ require .NoError (t , err )
300+ require .Equal (t , "test" , d .Name )
301+ require .Equal (t , 2 , len (d .Columns ))
302+ require .Equal (t , "id" , d .Columns [0 ].Name )
303+ require .Equal (t , "value" , d .Columns [1 ].Name )
304+ require .Equal (t , []string {"id" }, d .PrimaryKey )
305+ })
306+ })
307+ t .RunSynced ("WithStaticCredentialsLogin+WithStaticCredentialsPassword" ,
308+ func (t * xtest.SyncedTest ) {
309+ db , err := ydb .Open (ctx ,
310+ os .Getenv ("YDB_CONNECTION_STRING" ),
311+ ydb .WithStaticCredentialsLogin ("test" ),
312+ ydb .WithStaticCredentialsPassword ("password" ),
313+ )
314+ require .NoError (t , err )
315+ defer func () {
316+ _ = db .Close (ctx )
317+ }()
318+ tableName := path .Join (db .Name (), t .Name (), "test" )
319+ t .RunSynced ("CreateTable" , func (t * xtest.SyncedTest ) {
320+ err := db .Query ().Exec (ctx , fmt .Sprintf (`
273321 CREATE TABLE IF NOT EXISTS %s (
274322 id Uint64,
275323 value Utf8,
276324 PRIMARY KEY (id)
277325 )` , "`" + tableName + "`" ),
278- )
279- require .NoError (t , err )
280- })
281- t .RunSynced ("Query" , func (t * xtest.SyncedTest ) {
282- row , err := db .Query ().QueryRow (ctx , `SELECT 1` )
283- require .NoError (t , err )
284- var v int
285- err = row .Scan (& v )
286- require .NoError (t , err )
287- })
288- t .RunSynced ("DescribeTable" , func (t * xtest.SyncedTest ) {
289- var d options.Description
290- err := db .Table ().Do (ctx , func (ctx context.Context , s table.Session ) error {
291- d , err = s .DescribeTable (ctx , tableName )
292- if err != nil {
293- return err
294- }
326+ )
327+ require .NoError (t , err )
328+ })
329+ t .RunSynced ("Query" , func (t * xtest.SyncedTest ) {
330+ row , err := db .Query ().QueryRow (ctx , `SELECT 1` )
331+ require .NoError (t , err )
332+ var v int
333+ err = row .Scan (& v )
334+ require .NoError (t , err )
335+ })
336+ t .RunSynced ("DescribeTable" , func (t * xtest.SyncedTest ) {
337+ var d options.Description
338+ err := db .Table ().Do (ctx , func (ctx context.Context , s table.Session ) error {
339+ d , err = s .DescribeTable (ctx , tableName )
340+ if err != nil {
341+ return err
342+ }
295343
296- return nil
344+ return nil
345+ })
346+ require .NoError (t , err )
347+ require .Equal (t , "test" , d .Name )
348+ require .Equal (t , 2 , len (d .Columns ))
349+ require .Equal (t , "id" , d .Columns [0 ].Name )
350+ require .Equal (t , "value" , d .Columns [1 ].Name )
351+ require .Equal (t , []string {"id" }, d .PrimaryKey )
352+ })
297353 })
298- require .NoError (t , err )
299- require .Equal (t , "test" , d .Name )
300- require .Equal (t , 2 , len (d .Columns ))
301- require .Equal (t , "id" , d .Columns [0 ].Name )
302- require .Equal (t , "value" , d .Columns [1 ].Name )
303- require .Equal (t , []string {"id" }, d .PrimaryKey )
304- })
305354 })
306355 t .RunSynced ("WrongLogin" , func (t * xtest.SyncedTest ) {
307356 db , err := ydb .Open (ctx ,
0 commit comments