mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-26 17:24:21 -05:00
If the test name file cannot be found just use the settings.json
This commit is contained in:
@@ -18,9 +18,18 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
|
||||
{
|
||||
public class PerformanceTests : TestBase
|
||||
{
|
||||
private static string ComplexQuery = File.ReadAllText("./Scripts/AdventureWorks.sql");
|
||||
private static string ComplexQuery = LoadComplexScript();
|
||||
private static string SimpleQuery = "SELECT * FROM sys.all_columns";
|
||||
|
||||
|
||||
private static string LoadComplexScript()
|
||||
{
|
||||
string assemblyLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
|
||||
string folderName = Path.GetDirectoryName(assemblyLocation);
|
||||
string filePath = Path.Combine(folderName, "Scripts/AdventureWorks.sql");
|
||||
return File.ReadAllText(filePath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HoverTestOnPrem()
|
||||
{
|
||||
@@ -556,6 +565,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
|
||||
TestTimer timer = new TestTimer();
|
||||
T result = await testToRun();
|
||||
timer.EndAndPrint(testName);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,12 +183,32 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
|
||||
/// </summary>
|
||||
protected async Task<ConnectParams> GetDatabaseConnectionAsync(TestServerType serverType)
|
||||
{
|
||||
ConnectionProfile connectionProfile = null;
|
||||
TestServerIdentity serverIdentiry = ConnectionTestUtils.TestServers.FirstOrDefault(x => x.ServerType == serverType);
|
||||
var connectionProfile = ConnectionTestUtils.Setting.GetConnentProfile(serverIdentiry.ProfileName, serverIdentiry.ServerName);
|
||||
Credential credential = await ReadCredential(connectionProfile.formatCredentialId());
|
||||
ConnectParams conenctParam = ConnectionTestUtils.CreateConnectParams(connectionProfile.ServerName, connectionProfile.Database,
|
||||
connectionProfile.User, credential.Password);
|
||||
return conenctParam;
|
||||
if (serverIdentiry == null)
|
||||
{
|
||||
connectionProfile = ConnectionTestUtils.Setting.Connections.FirstOrDefault(x => x.ServerType == serverType);
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionProfile = ConnectionTestUtils.Setting.GetConnentProfile(serverIdentiry.ProfileName, serverIdentiry.ServerName);
|
||||
}
|
||||
|
||||
if (connectionProfile != null)
|
||||
{
|
||||
|
||||
|
||||
string password = connectionProfile.Password;
|
||||
if (string.IsNullOrEmpty(password))
|
||||
{
|
||||
Credential credential = await ReadCredential(connectionProfile.formatCredentialId());
|
||||
password = credential.Password;
|
||||
}
|
||||
ConnectParams conenctParam = ConnectionTestUtils.CreateConnectParams(connectionProfile.ServerName, connectionProfile.Database,
|
||||
connectionProfile.User, password);
|
||||
return conenctParam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user