Skip to content

Commit e03421f

Browse files
authored
Merge pull request #1152 from ydb-platform/parking-integration-test
revert integration tests
2 parents 1252c72 + 1a5ac7c commit e03421f

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

tests/integration/discovery_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func TestDiscovery(t *testing.T) {
4646
t.Fatalf("unknown request type: %s", requestTypes[0])
4747
}
4848
}
49-
ctx = xtest.Context(t)
49+
parking = make(chan struct{})
50+
ctx = xtest.Context(t)
5051
)
5152

5253
db, err := ydb.Open(ctx,
@@ -59,6 +60,7 @@ func TestDiscovery(t *testing.T) {
5960
config.WithOperationCancelAfter(time.Second*2),
6061
),
6162
ydb.WithBalancer(balancers.SingleConn()),
63+
ydb.WithConnectionTTL(time.Second*1),
6264
ydb.WithMinTLSVersion(tls.VersionTLS10),
6365
ydb.WithLogger(
6466
newLoggerWithMinLevel(t, log.WARN),
@@ -92,6 +94,13 @@ func TestDiscovery(t *testing.T) {
9294
}),
9395
),
9496
),
97+
ydb.WithTraceDriver(trace.Driver{
98+
OnConnPark: func(info trace.DriverConnParkStartInfo) func(trace.DriverConnParkDoneInfo) {
99+
return func(info trace.DriverConnParkDoneInfo) {
100+
parking <- struct{}{}
101+
}
102+
},
103+
}),
95104
)
96105
if err != nil {
97106
t.Fatal(err)
@@ -108,5 +117,17 @@ func TestDiscovery(t *testing.T) {
108117
} else {
109118
t.Log(endpoints)
110119
}
120+
t.Run("wait", func(t *testing.T) {
121+
t.Run("parking", func(t *testing.T) {
122+
<-parking // wait for parking conn
123+
t.Run("re-discover", func(t *testing.T) {
124+
if endpoints, err := db.Discovery().Discover(ctx); err != nil {
125+
t.Fatal(err)
126+
} else {
127+
t.Log(endpoints)
128+
}
129+
})
130+
})
131+
})
111132
})
112133
}

tests/integration/helpers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func (scope *scopeT) Driver(opts ...ydb.Option) *ydb.Driver {
8585

8686
token := scope.AuthToken()
8787
if token == "" {
88-
scope.Logf("Change empty auth token")
88+
scope.Logf("With empty auth token")
8989
} else {
90-
scope.Logf("Change auth token")
90+
scope.Logf("With auth token")
9191
}
9292

9393
connectionContext, cancel := context.WithTimeout(scope.Ctx, time.Second*10)

tests/integration/query_execute_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func TestQueryExecute(t *testing.T) {
3131
db, err := ydb.Open(ctx,
3232
os.Getenv("YDB_CONNECTION_STRING"),
3333
ydb.WithAccessTokenCredentials(os.Getenv("YDB_ACCESS_TOKEN_CREDENTIALS")),
34+
ydb.WithSessionPoolSizeLimit(10),
3435
ydb.WithTraceQuery(
3536
log.Query(
3637
log.Default(os.Stdout,
@@ -43,6 +44,11 @@ func TestQueryExecute(t *testing.T) {
4344
),
4445
)
4546
require.NoError(t, err)
47+
t.Run("Stats", func(t *testing.T) {
48+
s, err := query.Stats(db.Query())
49+
require.NoError(t, err)
50+
require.EqualValues(t, 10, s.Limit)
51+
})
4652
t.Run("Scan", func(t *testing.T) {
4753
var (
4854
p1 string

tests/integration/topic_grpc_stopper_helper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
//
2020
// db, err := ydb.Open(context.Background(), connectionString,
2121
// ...
22-
// ydb.Change(config.WithGrpcOptions(grpc.WithChainUnaryInterceptor(grpcStopper.UnaryClientInterceptor)),
23-
// ydb.Change(config.WithGrpcOptions(grpc.WithStreamInterceptor(grpcStopper.StreamClientInterceptor)),
22+
// ydb.With(config.WithGrpcOptions(grpc.WithChainUnaryInterceptor(grpcStopper.UnaryClientInterceptor)),
23+
// ydb.With(config.WithGrpcOptions(grpc.WithStreamInterceptor(grpcStopper.StreamClientInterceptor)),
2424
// ),
2525
//
2626
// grpcStopper.Stop(errors.New("test error"))

0 commit comments

Comments
 (0)