Skip to content

Commit

Permalink
fix flap test: wait for closing execQuery stream from server (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov authored Dec 25, 2024
1 parent 5e76cf1 commit 79e3315
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Ydb.Sdk/tests/Ado/YdbCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ public void ExecuteDbDataReader_WhenPreviousIsNotClosed_ThrowException()

Assert.Equal("A command is already in progress: SELECT 1; SELECT 1;",
Assert.Throws<YdbOperationInProgressException>(() => dbCommand.ExecuteReader()).Message);
Assert.True(ydbDataReader.NextResult());
Assert.True(ydbDataReader.NextResult());
Assert.False(ydbDataReader.NextResult());

ydbDataReader.Close();
Assert.True(ydbDataReader.IsClosed);
}
Expand Down Expand Up @@ -331,6 +335,7 @@ public void GetChars_WhenSelectText_MoveCharsToBuffer()
Assert.Equal(checkBuffer, bufferChars);

Assert.Equal('a', ydbDataReader.GetChar(0));
Assert.False(ydbDataReader.Read());
}

[Fact]
Expand Down Expand Up @@ -377,6 +382,7 @@ public void GetBytes_WhenSelectBytes_MoveBytesToBuffer()
checkBuffer[6] = (byte)'b';
checkBuffer[7] = (byte)'a';
Assert.Equal(checkBuffer, bufferChars);
Assert.False(ydbDataReader.Read());
}

[Fact]
Expand Down
5 changes: 5 additions & 0 deletions src/Ydb.Sdk/tests/Ado/YdbTransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public void CommitAndRollback_WhenStreamIsOpened_ThrowException()
Assert.Equal("A command is already in progress: SELECT 1; SELECT 2; SELECT 3",
Assert.Throws<YdbOperationInProgressException>(() => ydbTransaction.Rollback()).Message);

Assert.True(dbDataReader.NextResult());
Assert.True(dbDataReader.NextResult());
Assert.True(dbDataReader.NextResult());
Assert.False(dbDataReader.NextResult());

dbDataReader.Close(); // Close stream
ydbTransaction.Commit();
Assert.Equal("This YdbTransaction has completed; it is no longer usable",
Expand Down

0 comments on commit 79e3315

Please sign in to comment.