@@ -18,6 +18,7 @@ import (
1818
1919 "github.com/ydb-platform/ydb-go-sdk/v3"
2020 "github.com/ydb-platform/ydb-go-sdk/v3/credentials"
21+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/version"
2122)
2223
2324func TestDatabaseSqlStaticCredentials (t * testing.T ) {
@@ -36,7 +37,11 @@ func TestDatabaseSqlStaticCredentials(t *testing.T) {
3637 t .Fatal (err )
3738 }
3839
39- u .User = url .UserPassword ("root" , "" )
40+ if version .Gte (os .Getenv ("YDB_VERSION" ), "23.3" ) {
41+ u .User = url .UserPassword ("root" , "1234" )
42+ } else {
43+ u .User = url .User ("root" )
44+ }
4045
4146 t .Run ("sql.Open" , func (t * testing.T ) {
4247 var db * sql.DB
@@ -53,7 +58,10 @@ func TestDatabaseSqlStaticCredentials(t *testing.T) {
5358 t .Run ("sql.OpenDB" , func (t * testing.T ) {
5459 var cc * ydb.Driver
5560 cc , err = ydb .Open (ctx , os .Getenv ("YDB_CONNECTION_STRING" ),
56- ydb .WithCredentials (credentials .NewStaticCredentials ("root" , "" , u .Host , func () grpc.DialOption {
61+ ydb .WithCredentials (credentials .NewStaticCredentials (u .User .Username (), func () string {
62+ password , _ := u .User .Password ()
63+ return password
64+ }(), u .Host , func () grpc.DialOption {
5765 if u .Scheme == "grpcs" { //nolint:goconst
5866 transportCredentials , transportCredentialsErr := grpcCredentials .NewClientTLSFromFile (
5967 os .Getenv ("YDB_SSL_ROOT_CERTIFICATES_FILE" ), u .Hostname (),
@@ -64,7 +72,8 @@ func TestDatabaseSqlStaticCredentials(t *testing.T) {
6472 return grpc .WithTransportCredentials (transportCredentials )
6573 }
6674 return grpc .WithTransportCredentials (insecure .NewCredentials ())
67- }())))
75+ }())),
76+ )
6877 require .NoError (t , err )
6978
7079 defer func () {
0 commit comments