Skip to content

Commit 1fee059

Browse files
committed
tests on ado + blank
1 parent 2b83767 commit 1fee059

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/Ydb.Sdk/src/DriverConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Ydb.Sdk;
77
public class DriverConfig
88
{
99
private readonly string _pid = Environment.ProcessId.ToString();
10+
1011
public string Endpoint { get; }
1112
public string Database { get; }
1213
public ICredentialsProvider? Credentials { get; }
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
using Xunit;
22
using Ydb.Sdk.Services.Query;
3+
using Ydb.Sdk.Tests.Ado.Specification;
34
using Ydb.Sdk.Tests.Fixture;
45

56
namespace Ydb.Sdk.Tests.Sys;
67

7-
public class QuerySessionTests : IClassFixture<QueryClientFixture>
8+
public class QuerySessionTests : YdbAdoNetFixture
89
{
9-
private readonly QueryClient _queryClient;
10-
11-
public QuerySessionTests(QueryClientFixture queryClientFixture)
10+
public QuerySessionTests(YdbFactoryFixture fixture) : base(fixture)
1211
{
13-
_queryClient = queryClientFixture.QueryClient;
1412
}
1513

1614
[Fact]
1715
public async Task QuerySessionPidTest()
1816
{
19-
const string sql = @"SELECT * FROM `.sys/query_sessions` LIMIT 1";
17+
await using var connection = await CreateOpenConnectionAsync();
18+
var dbCommand = connection.CreateCommand();
19+
dbCommand.CommandText = "SELECT ClientPID FROM `.sys/query_sessions` LIMIT 1;";
20+
2021
var expectedPid = Environment.ProcessId.ToString();
22+
23+
await dbCommand.ExecuteNonQueryAsync();
24+
await using var reader = await dbCommand.ExecuteReaderAsync();
2125

22-
await _queryClient.Exec(sql);
23-
var sessionRow = await _queryClient.ReadRow(sql);
24-
25-
Assert.NotNull(sessionRow);
26-
Assert.Equal(sessionRow["ClientPID"].GetOptionalUtf8(), expectedPid);
26+
Assert.True(reader.HasRows);
27+
Assert.True(await reader.ReadAsync());
28+
Assert.Equal(reader.GetString(0), expectedPid);
2729
}
2830
}

0 commit comments

Comments
 (0)