Skip to content

Commit bce849a

Browse files
ADO.NET tests using ydb slice
1 parent bb6dfb0 commit bce849a

File tree

6 files changed

+50
-42
lines changed

6 files changed

+50
-42
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ jobs:
6767
uses: actions/setup-dotnet@v4
6868
with:
6969
dotnet-version: ${{ matrix.dotnet-version }}
70+
- name: Set up QEMU
71+
uses: docker/setup-qemu-action@v3
72+
- name: Build YDB Slice
73+
run: docker-compose -f ./.github/ydb-slice-compose.yaml up -d
7074
- name: Run ADO.NET tests
7175
run: |
76+
ConnectionString="Host=localhost;Port=3135;Database=/Root/testdb"
7277
docker cp ydb-local:/ydb_certs/ca.pem ~/
7378
cd src
7479
dotnet test --filter "(FullyQualifiedName~Ado) | (FullyQualifiedName~Dapper)" -f ${{ matrix.dotnet-target-framework }} -l "console;verbosity=normal"

.github/compose.yaml renamed to .github/ydb-slice-compose.yaml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
- /opt/ydb/bin/ydbd
2222
- server
2323
- --grpc-port
24-
- "2135"
24+
- "3135"
2525
- --mon-port
2626
- "8765"
2727
- --ic-port
@@ -33,11 +33,11 @@ services:
3333
- --label
3434
- deployment=docker
3535
ports:
36-
- 2135:2135
36+
- 3135:3135
3737
- 8765:8765
3838
- 19001:19001
3939
healthcheck:
40-
test: bash -c "exec 6<> /dev/tcp/localhost/2135"
40+
test: bash -c "exec 6<> /dev/tcp/localhost/3135"
4141
interval: 10s
4242
timeout: 1s
4343
retries: 3
@@ -50,7 +50,7 @@ services:
5050
command:
5151
- /opt/ydb/bin/ydbd
5252
- -s
53-
- grpc://localhost:2135
53+
- grpc://localhost:3135
5454
- admin
5555
- blobstorage
5656
- config
@@ -68,7 +68,7 @@ services:
6868
command:
6969
- /opt/ydb/bin/ydbd
7070
- -s
71-
- grpc://localhost:2135
71+
- grpc://localhost:3135
7272
- admin
7373
- database
7474
- /Root/testdb
@@ -85,7 +85,7 @@ services:
8585
- /opt/ydb/bin/ydbd
8686
- server
8787
- --grpc-port
88-
- "2136"
88+
- "3136"
8989
- --mon-port
9090
- "8766"
9191
- --ic-port
@@ -95,15 +95,15 @@ services:
9595
- --tenant
9696
- /Root/testdb
9797
- --node-broker
98-
- grpc://localhost:2135
98+
- grpc://localhost:3135
9999
- --label
100100
- deployment=docker
101101
ports:
102-
- 2136:2136
102+
- 3136:3136
103103
- 8766:8766
104104
- 19002:19002
105105
healthcheck:
106-
test: bash -c "exec 6<> /dev/tcp/localhost/2136"
106+
test: bash -c "exec 6<> /dev/tcp/localhost/3136"
107107
interval: 10s
108108
timeout: 1s
109109
retries: 3
@@ -123,7 +123,7 @@ services:
123123
- /opt/ydb/bin/ydbd
124124
- server
125125
- --grpc-port
126-
- "2137"
126+
- "3137"
127127
- --mon-port
128128
- "8767"
129129
- --ic-port
@@ -133,15 +133,15 @@ services:
133133
- --tenant
134134
- /Root/testdb
135135
- --node-broker
136-
- grpc://localhost:2135
136+
- grpc://localhost:3135
137137
- --label
138138
- deployment=docker
139139
ports:
140-
- 2137:2137
140+
- 3137:3137
141141
- 8767:8767
142142
- 19003:19003
143143
healthcheck:
144-
test: bash -c "exec 6<> /dev/tcp/localhost/2137"
144+
test: bash -c "exec 6<> /dev/tcp/localhost/3137"
145145
interval: 10s
146146
timeout: 1s
147147
retries: 3
@@ -161,7 +161,7 @@ services:
161161
- /opt/ydb/bin/ydbd
162162
- server
163163
- --grpc-port
164-
- "2138"
164+
- "3138"
165165
- --mon-port
166166
- "8768"
167167
- --ic-port
@@ -171,15 +171,15 @@ services:
171171
- --tenant
172172
- /Root/testdb
173173
- --node-broker
174-
- grpc://localhost:2135
174+
- grpc://localhost:3135
175175
- --label
176176
- deployment=docker
177177
ports:
178-
- 2138:2138
178+
- 3138:3138
179179
- 8768:8768
180180
- 19004:19004
181181
healthcheck:
182-
test: bash -c "exec 6<> /dev/tcp/localhost/2138"
182+
test: bash -c "exec 6<> /dev/tcp/localhost/3138"
183183
interval: 10s
184184
timeout: 1s
185185
retries: 3
@@ -199,7 +199,7 @@ services:
199199
- /opt/ydb/bin/ydbd
200200
- server
201201
- --grpc-port
202-
- "2139"
202+
- "3139"
203203
- --mon-port
204204
- "8769"
205205
- --ic-port
@@ -209,15 +209,15 @@ services:
209209
- --tenant
210210
- /Root/testdb
211211
- --node-broker
212-
- grpc://localhost:2135
212+
- grpc://localhost:3135
213213
- --label
214214
- deployment=docker
215215
ports:
216-
- 2139:2139
216+
- 3139:3139
217217
- 8769:8769
218218
- 19005:19005
219219
healthcheck:
220-
test: bash -c "exec 6<> /dev/tcp/localhost/2139"
220+
test: bash -c "exec 6<> /dev/tcp/localhost/3139"
221221
interval: 10s
222222
timeout: 1s
223223
retries: 3
@@ -237,7 +237,7 @@ services:
237237
- /opt/ydb/bin/ydbd
238238
- server
239239
- --grpc-port
240-
- "2140"
240+
- "3140"
241241
- --mon-port
242242
- "8770"
243243
- --ic-port
@@ -247,15 +247,15 @@ services:
247247
- --tenant
248248
- /Root/testdb
249249
- --node-broker
250-
- grpc://localhost:2135
250+
- grpc://localhost:3135
251251
- --label
252252
- deployment=docker
253253
ports:
254-
- 2140:2140
254+
- 3140:3140
255255
- 8770:8770
256256
- 19006:19006
257257
healthcheck:
258-
test: bash -c "exec 6<> /dev/tcp/localhost/2140"
258+
test: bash -c "exec 6<> /dev/tcp/localhost/3140"
259259
interval: 10s
260260
timeout: 1s
261261
retries: 3

src/Ydb.Sdk/tests/Ado/Specification/YdbFactoryFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public class YdbFactoryFixture : IDbFactoryFixture
88
{
99
public DbProviderFactory Factory => YdbProviderFactory.Instance;
1010

11-
public string ConnectionString => "Host=localhost;Port=2136;Database=/Root/testdb";
11+
public string ConnectionString => "Host=localhost;Port=2136;Database=/local";
1212
}

src/Ydb.Sdk/tests/Ado/YdbAdoUserPasswordTests.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,38 @@ public YdbAdoUserPasswordTests(YdbFactoryFixture fixture) : base(fixture)
1414
[Fact]
1515
public async Task Authentication_WhenUserAndPassword_ReturnValidConnection()
1616
{
17-
await using var connection = await CreateOpenConnectionAsync();
17+
await using var connection = new YdbConnection(Fixture.ConnectionString);
18+
await connection.OpenAsync();
1819
var ydbCommand = connection.CreateCommand();
1920
var kurdyukovkirya = "kurdyukovkirya" + Random.Shared.Next();
2021
ydbCommand.CommandText = $"CREATE USER {kurdyukovkirya} PASSWORD 'password'";
2122
await ydbCommand.ExecuteNonQueryAsync();
2223
await connection.CloseAsync();
2324

2425
await using var userPasswordConnection =
25-
new YdbConnection($"{ConnectionString};User={kurdyukovkirya};Password=password;");
26+
new YdbConnection($"{Fixture.ConnectionString};User={kurdyukovkirya};Password=password;");
2627
await userPasswordConnection.OpenAsync();
2728
ydbCommand = userPasswordConnection.CreateCommand();
2829
ydbCommand.CommandText = "SELECT 1 + 2";
2930
Assert.Equal(3, await ydbCommand.ExecuteScalarAsync());
3031

31-
await using var newConnection = new YdbConnection();
32-
await newConnection.OpenAsync();
32+
await using var newConnection = new YdbConnection(Fixture.ConnectionString);
33+
await connection.OpenAsync();
3334
ydbCommand = newConnection.CreateCommand();
3435
ydbCommand.CommandText = $"DROP USER {kurdyukovkirya};";
3536
await ydbCommand.ExecuteNonQueryAsync();
3637
}
38+
39+
[Fact]
40+
public async Task ExecuteNonQueryAsync_WhenCreateUser_ReturnEmptyResultSet()
41+
{
42+
await using var connection = new YdbConnection(Fixture.ConnectionString);
43+
await connection.OpenAsync();
44+
var dbCommand = connection.CreateCommand();
45+
var user = "user" + Random.Shared.Next();
46+
dbCommand.CommandText = $"CREATE USER {user} PASSWORD '123qweqwe'";
47+
await dbCommand.ExecuteNonQueryAsync();
48+
dbCommand.CommandText = $"DROP USER {user};";
49+
await dbCommand.ExecuteNonQueryAsync();
50+
}
3751
}

src/Ydb.Sdk/tests/Ado/YdbCommandTests.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,6 @@ public async Task ExecuteScalarAsync_WhenNoDbTypeParameter_ReturnThisValue()
125125
}
126126
}
127127

128-
[Fact]
129-
public async Task ExecuteNonQueryAsync_WhenCreateUser_ReturnEmptyResultSet()
130-
{
131-
await using var connection = await CreateOpenConnectionAsync();
132-
var dbCommand = connection.CreateCommand();
133-
dbCommand.CommandText = "CREATE USER user PASSWORD '123qweqwe'";
134-
await dbCommand.ExecuteNonQueryAsync();
135-
dbCommand.CommandText = "DROP USER user;";
136-
await dbCommand.ExecuteNonQueryAsync();
137-
}
138-
139128
[Fact]
140129
public async Task CloseAsync_WhenDoubleInvoke_Idempotent()
141130
{

src/Ydb.Sdk/tests/Ado/YdbConnectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public async Task ClearPoolAllPools_WhenHasActiveConnection_CloseActiveConnectio
5353
public async Task TlsSettings_WhenUseGrpcs_ReturnValidConnection()
5454
{
5555
var connectionStringBuilder = new YdbConnectionStringBuilder(
56-
$"{ConnectionString};MaxSessionPool=10;RootCertificate=" +
56+
$"{Fixture.ConnectionString};MaxSessionPool=10;RootCertificate=" +
5757
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ca.pem"))
5858
{
5959
Port = 2135

0 commit comments

Comments
 (0)