mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-02 09:35:38 -05:00
Perf Test fixing bugs and Update command (#155)
* Fixed some bugs caused by rafactoring * Verifying a test db is created before running the tests
This commit is contained in:
@@ -11,18 +11,20 @@ using Microsoft.SqlTools.ServiceLayer.TestDriver.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.PerfTests.Tests
|
||||
namespace Microsoft.SqlTools.ServiceLayer.PerfTests
|
||||
{
|
||||
public class ConnectionTests
|
||||
{
|
||||
|
||||
[Fact]
|
||||
[CreateTestDb(TestServerType.Azure)]
|
||||
public async Task ConnectAzureTest()
|
||||
{
|
||||
TestServerType serverType = TestServerType.Azure;
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
using (TestHelper testHelper = new TestHelper())
|
||||
{
|
||||
const string query = Scripts.SimpleQuery;
|
||||
const string query = Scripts.TestDbSimpleSelectQuery;
|
||||
testHelper.WriteToFile(queryTempFile.FilePath, query);
|
||||
|
||||
DidOpenTextDocumentNotification openParams = new DidOpenTextDocumentNotification
|
||||
@@ -41,20 +43,23 @@ namespace Microsoft.SqlTools.ServiceLayer.PerfTests.Tests
|
||||
Thread.Sleep(500);
|
||||
var connected = await Common.CalculateRunTime(async () =>
|
||||
{
|
||||
var connectParams = await testHelper.GetDatabaseConnectionAsync(TestServerType.Azure);
|
||||
var connectParams = await testHelper.GetDatabaseConnectionAsync(serverType, Common.PerfTestDatabaseName);
|
||||
return await testHelper.Connect(queryTempFile.FilePath, connectParams);
|
||||
});
|
||||
}, true);
|
||||
Assert.True(connected, "Connection was not successful");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[CreateTestDb(TestServerType.OnPrem)]
|
||||
public async Task ConnectOnPremTest()
|
||||
{
|
||||
TestServerType serverType = TestServerType.OnPrem;
|
||||
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
using (TestHelper testHelper = new TestHelper())
|
||||
{
|
||||
const string query = Scripts.SimpleQuery;
|
||||
const string query = Scripts.TestDbSimpleSelectQuery;
|
||||
testHelper.WriteToFile(queryTempFile.FilePath, query);
|
||||
|
||||
DidOpenTextDocumentNotification openParams = new DidOpenTextDocumentNotification
|
||||
@@ -73,22 +78,25 @@ namespace Microsoft.SqlTools.ServiceLayer.PerfTests.Tests
|
||||
Thread.Sleep(500);
|
||||
var connected = await Common.CalculateRunTime(async () =>
|
||||
{
|
||||
var connectParams = await testHelper.GetDatabaseConnectionAsync(TestServerType.OnPrem);
|
||||
var connectParams = await testHelper.GetDatabaseConnectionAsync(serverType, Common.PerfTestDatabaseName);
|
||||
return await testHelper.Connect(queryTempFile.FilePath, connectParams);
|
||||
});
|
||||
}, true);
|
||||
Assert.True(connected, "Connection was not successful");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[CreateTestDb(TestServerType.OnPrem)]
|
||||
public async Task DisconnectTest()
|
||||
{
|
||||
TestServerType serverType = TestServerType.OnPrem;
|
||||
|
||||
using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
|
||||
using (TestHelper testHelper = new TestHelper())
|
||||
{
|
||||
await Common.ConnectAsync(testHelper, TestServerType.OnPrem, Scripts.SimpleQuery, queryTempFile.FilePath);
|
||||
await Common.ConnectAsync(testHelper, serverType, Scripts.TestDbSimpleSelectQuery, queryTempFile.FilePath, Common.PerfTestDatabaseName);
|
||||
Thread.Sleep(1000);
|
||||
var connected = await Common.CalculateRunTime(() => testHelper.Disconnect(queryTempFile.FilePath));
|
||||
var connected = await Common.CalculateRunTime(() => testHelper.Disconnect(queryTempFile.FilePath), true);
|
||||
Assert.True(connected);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user