mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Do not use ReliableCommand in the query execution service (#66)
* Do not use ReliableCommand in the query execution service. * Fixing the logic to remove InfoMessage handlers from ReliableSqlConnection * Adding test to query UDT
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
//#define USE_LIVE_CONNECTION
|
||||
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
@@ -17,6 +19,7 @@ using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Test.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Microsoft.SqlTools.Test.Utility;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
@@ -667,7 +670,35 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||
Assert.NotEmpty(complete.BatchSummaries[0].Messages);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#if USE_LIVE_CONNECTION
|
||||
[Fact]
|
||||
public void QueryUdtShouldNotRetry()
|
||||
{
|
||||
// If:
|
||||
// ... I create a query with a udt column in the result set
|
||||
ConnectionInfo connectionInfo = TestObjects.GetTestConnectionInfo();
|
||||
Query query = new Query(Common.UdtQuery, connectionInfo, new QueryExecutionSettings(), Common.GetFileStreamFactory());
|
||||
|
||||
// If:
|
||||
// ... I then execute the query
|
||||
DateTime startTime = DateTime.Now;
|
||||
query.Execute().Wait();
|
||||
|
||||
// Then:
|
||||
// ... The query should complete within 2 seconds since retry logic should not kick in
|
||||
Assert.True(DateTime.Now.Subtract(startTime) < TimeSpan.FromSeconds(2), "Query completed slower than expected, did retry logic execute?");
|
||||
|
||||
// Then:
|
||||
// ... There should be an error on the batch
|
||||
Assert.True(query.HasExecuted);
|
||||
Assert.NotEmpty(query.BatchSummaries);
|
||||
Assert.Equal(1, query.BatchSummaries.Length);
|
||||
Assert.True(query.BatchSummaries[0].HasError);
|
||||
Assert.NotEmpty(query.BatchSummaries[0].Messages);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
private void VerifyQueryExecuteCallCount(Mock<RequestContext<QueryExecuteResult>> mock, Times sendResultCalls, Times sendEventCalls, Times sendErrorCalls)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user