Skip to content

Commit

Permalink
Remove public constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Mar 25, 2024
1 parent e1c50b6 commit 3801171
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 10 additions & 5 deletions Snowflake.Data.Tests/IntegrationTests/SFDbCommandIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,13 @@ public async Task TestGetResultsOfUnknownQueryIdAsyncWithConfiguredRetry()
conn.ConnectionString = ConnectionString;
await conn.OpenAsync(CancellationToken.None).ConfigureAwait(false);

using (SnowflakeDbCommand cmd = new SnowflakeDbCommand(conn, new QueryResultsRetryConfig(queryResultsRetryCount, queryResultsRetryPattern)))
using (SnowflakeDbCommand cmd = (SnowflakeDbCommand)conn.CreateCommand())
{
QueryResultsAwaiter queryResultsAwaiter = new QueryResultsAwaiter(new QueryResultsRetryConfig(queryResultsRetryCount, queryResultsRetryPattern));

// Act
var thrown = Assert.ThrowsAsync<Exception>(async () =>
await cmd.GetResultsFromQueryIdAsync(unknownQueryId, CancellationToken.None).ConfigureAwait(false));
await queryResultsAwaiter.RetryUntilQueryResultIsAvailable(conn, unknownQueryId, CancellationToken.None, true).ConfigureAwait(false));

// Assert
Assert.IsTrue(thrown.Message.Contains($"Max retry for no data is reached"));
Expand Down Expand Up @@ -1604,11 +1606,14 @@ public void TestGetResultsOfUnknownQueryIdWithConfiguredRetry()
{
conn.ConnectionString = ConnectionString;
conn.Open();

using (SnowflakeDbCommand cmd = new SnowflakeDbCommand(conn, new QueryResultsRetryConfig(queryResultsRetryCount, queryResultsRetryPattern)))
using (SnowflakeDbCommand cmd = (SnowflakeDbCommand)conn.CreateCommand())
{
// Arrange
QueryResultsAwaiter queryResultsAwaiter = new QueryResultsAwaiter(new QueryResultsRetryConfig(queryResultsRetryCount, queryResultsRetryPattern));
var task = queryResultsAwaiter.RetryUntilQueryResultIsAvailable(conn, unknownQueryId, CancellationToken.None, false);

// Act
var thrown = Assert.Throws<AggregateException>(() => cmd.GetResultsFromQueryId(unknownQueryId));
var thrown = Assert.Throws<AggregateException>(() => task.Wait());

// Assert
Assert.IsTrue(thrown.InnerException.Message.Contains($"Max retry for no data is reached"));
Expand Down
5 changes: 0 additions & 5 deletions Snowflake.Data/Client/SnowflakeDbCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public SnowflakeDbCommand(SnowflakeDbConnection connection, string cmdText) : th
this.CommandText = cmdText;
}

public SnowflakeDbCommand(SnowflakeDbConnection connection, QueryResultsRetryConfig queryResultsRetryConfig) : this(connection)
{
_queryResultsAwaiter = new QueryResultsAwaiter(queryResultsRetryConfig);
}

public override string CommandText
{
get; set;
Expand Down

0 comments on commit 3801171

Please sign in to comment.