mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 17:23:38 -05:00
Fixed issue where no-op queries would never complete (#157)
* Fixed issue where no-op queries would never complete * Changed approach to solving the race condition with no-op queries * Addressing feedback
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TestDriver.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
@@ -323,5 +324,36 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
|
||||
await testHelper.Disconnect(queryTempFile.FilePath);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NoOpQueryReturnsMessage()
|
||||
{
|
||||
// Given queries that do nothing (no-ops)...
|
||||
var queries = new string[]
|
||||
{
|
||||
"-- no-op",
|
||||
"GO",
|
||||
"GO -- no-op"
|
||||
};
|
||||
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
using (TestHelper testHelper = new TestHelper())
|
||||
{
|
||||
foreach (var query in queries)
|
||||
{
|
||||
Assert.True(await testHelper.Connect(queryTempFile.FilePath, ConnectionTestUtils.LocalhostConnection));
|
||||
|
||||
// If the queries are executed...
|
||||
var queryResult = await testHelper.RunQueryAsync(queryTempFile.FilePath, query);
|
||||
|
||||
// Then I expect messages that the commands were completed successfully to be in the result
|
||||
Assert.NotNull(queryResult);
|
||||
Assert.NotNull(queryResult.Messages);
|
||||
Assert.Equal("Commands completed successfully.", queryResult.Messages);
|
||||
|
||||
await testHelper.Disconnect(queryTempFile.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user