Skip to content

Commit f8db069

Browse files
committed
fix TestStaticCredentials for 23.3
1 parent d2fa190 commit f8db069

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/integration/static_credentials_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/ydb-platform/ydb-go-sdk/v3"
1919
"github.com/ydb-platform/ydb-go-sdk/v3/credentials"
20+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/version"
2021
)
2122

2223
func TestStaticCredentials(t *testing.T) {
@@ -30,15 +31,24 @@ func TestStaticCredentials(t *testing.T) {
3031
dsn = v
3132
}
3233

33-
url, err := url.Parse(dsn)
34+
u, err := url.Parse(dsn)
3435
if err != nil {
3536
t.Fatal(err)
3637
}
3738

38-
staticCredentials := credentials.NewStaticCredentials("root", "", url.Host, func() grpc.DialOption {
39-
if url.Scheme == "grpcs" {
39+
if version.Gte(os.Getenv("YDB_VERSION"), "23.3") {
40+
u.User = url.UserPassword("root", "1234")
41+
} else {
42+
u.User = url.User("root")
43+
}
44+
45+
staticCredentials := credentials.NewStaticCredentials(u.User.Username(), func() string {
46+
password, _ := u.User.Password()
47+
return password
48+
}(), u.Host, func() grpc.DialOption {
49+
if u.Scheme == "grpcs" {
4050
transportCredentials, transportCredentialsErr := grpcCredentials.NewClientTLSFromFile(
41-
os.Getenv("YDB_SSL_ROOT_CERTIFICATES_FILE"), url.Hostname(),
51+
os.Getenv("YDB_SSL_ROOT_CERTIFICATES_FILE"), u.Hostname(),
4252
)
4353
if err != nil {
4454
t.Fatalf("cannot create transport credentials: %v", transportCredentialsErr)

0 commit comments

Comments
 (0)