From c28a97e6fa5e0dc882155601f1b8af335d04c46b Mon Sep 17 00:00:00 2001 From: Leila Lali Date: Thu, 22 Jun 2017 09:20:58 -0700 Subject: [PATCH] Fix/integrationtests (#391) * fixed the problem with parsing sql2017 version --- .../ReliableConnectionHelper.cs | 6 ++ .../ObjectExplorer/SmoModel/SmoQueryModel.tt | 5 ++ .../SmoModel/TreeNodeGenerator.cs | 56 +++++++++---------- .../SmoModel/TreeNodeGenerator.tt | 5 ++ .../LanguageServer/PeekDefinitionTests.cs | 24 ++++++-- .../ObjectExplorerServiceTests.cs | 2 +- .../Baselined/BaselinedTest.cs | 4 +- .../generateSQLConnectionSettings.sh | 16 ++++++ .../TaskServices/TaskServiceTests.cs | 2 + 9 files changed, 83 insertions(+), 37 deletions(-) create mode 100644 test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/generateSQLConnectionSettings.sh diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/ReliableConnectionHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/ReliableConnectionHelper.cs index d6348122..fe6db5f8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/ReliableConnectionHelper.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/ReliableConnectionHelper.cs @@ -605,6 +605,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection { // Remove filename from the filePath Uri pathUri; + if (!Uri.IsWellFormedUriString(filePath, UriKind.Absolute)) + { + // In linux "file://" is required otehrwise the Uri cannot parse the path + //this should be fixed in dotenet core 2.0 + filePath = $"file://{filePath}"; + } if (!Uri.TryCreate(filePath, UriKind.Absolute, out pathUri)) { // Invalid Uri diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt index 0c9fb75c..e5f442ad 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/SmoQueryModel.tt @@ -268,6 +268,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel flags.Add("ValidForFlag.Sql2016"); } + if (validForStr.Contains("Sql2017")) + { + flags.Add("ValidForFlag.Sql2017"); + } + if (validForStr.Contains("AzureV12")) { flags.Add("ValidForFlag.AzureV12"); diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.cs index a54614f2..4a4944e2 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.cs @@ -673,7 +673,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Synonyms, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -688,7 +688,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalResources, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -754,7 +754,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "TemporalType", Type = typeof(Enum), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { TableTemporalType.None }, @@ -773,7 +773,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel properties.Add(new NodeSmoProperty { Name = "IsSystemVersioned", - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12 + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12 }); return properties; } @@ -907,7 +907,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseTriggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -930,7 +930,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Sequences, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -957,7 +957,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalDataSources, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -965,7 +965,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ExternalFileFormats, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1027,7 +1027,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.BrokerPriorities, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1068,7 +1068,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.FullTextStopLists, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1097,7 +1097,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SearchPropertyLists, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1169,7 +1169,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseScopedCredentials, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1177,7 +1177,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseEncryptionKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1193,7 +1193,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.DatabaseAuditSpecifications, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1201,7 +1201,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SecurityPolicies, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1209,7 +1209,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.AlwaysEncryptedKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -1276,7 +1276,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "TemporalType", Type = typeof(Enum), TypeToReverse = typeof(SqlHistoryTableQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { TableTemporalType.HistoryTable } @@ -1314,7 +1314,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Triggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1487,7 +1487,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "IndexKeyType", Type = typeof(Enum), TypeToReverse = typeof(SqlIndexQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { IndexKeyType.DriPrimaryKey }, @@ -1580,7 +1580,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "IndexKeyType", Type = typeof(Enum), TypeToReverse = typeof(SqlIndexQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { IndexKeyType.None } @@ -1689,7 +1689,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.Triggers, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1881,7 +1881,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.UserDefinedDataTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -1889,7 +1889,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.UserDefinedTableTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -2013,7 +2013,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.SystemSpatialDataTypes, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } @@ -2210,7 +2210,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel Property = "IndexKeyType", Type = typeof(Enum), TypeToReverse = typeof(SqlIndexQuerier), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { IndexKeyType.DriPrimaryKey }, @@ -2838,7 +2838,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel { Property = "FunctionType", Type = typeof(Enum), - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, Values = new List { { UserDefinedFunctionType.Scalar } @@ -3607,7 +3607,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ColumnMasterKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); currentChildren.Add(new FolderNode { @@ -3615,7 +3615,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel NodeType = "Folder", NodeTypeId = NodeTypes.ColumnEncryptionKeys, IsSystemObject = false, - ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12, + ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12, SortPriority = SmoTreeNode.NextSortPriority, }); } diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.tt b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.tt index 5d626c38..26cf6268 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.tt +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/TreeNodeGenerator.tt @@ -369,6 +369,11 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel flags.Add("ValidForFlag.Sql2016"); } + if (validForStr.Contains("Sql2017")) + { + flags.Add("ValidForFlag.Sql2017"); + } + if (validForStr.Contains("AzureV12")) { flags.Add("ValidForFlag.AzureV12"); diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs index d17080d2..83ad15cd 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/LanguageServer/PeekDefinitionTests.cs @@ -828,17 +828,29 @@ GO"; /// private void Cleanup(Location[] locations) { - Uri fileUri = new Uri(locations[0].Uri); - if (File.Exists(fileUri.LocalPath)) + try { - try + string filePath = locations[0].Uri; + Uri fileUri = null; + if (Uri.IsWellFormedUriString(filePath, UriKind.Absolute)) { - File.Delete(fileUri.LocalPath); + fileUri = new Uri(filePath); } - catch (Exception) + else { - + filePath = filePath.Replace("file:/", "file://"); + if (Uri.IsWellFormedUriString(filePath, UriKind.Absolute)) + { + fileUri = new Uri(filePath); + } } + if (fileUri != null && File.Exists(fileUri.LocalPath)) + { + File.Delete(fileUri.LocalPath); + } + } + catch (Exception) + { } } diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs index 3a7f1c47..791c5fd6 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/ObjectExplorer/ObjectExplorerServiceTests.cs @@ -375,7 +375,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.ObjectExplorer VerifyMetadata(child); if (stringBuilder != null && child.NodeType != "Folder" && child.NodeType != "FileGroupFile") { - stringBuilder.AppendLine($"NodeType: {child.NodeType} Label: {child.Label} SubType:{child.NodeSubType} Status:{child.NodeStatus}"); + stringBuilder.Append($"NodeType: {child.NodeType} Label: {child.Label} SubType:{child.NodeSubType} Status:{child.NodeStatus}{Environment.NewLine}"); } if (!verifySystemObjects && (child.Label == SR.SchemaHierarchy_SystemStoredProcedures || child.Label == SR.SchemaHierarchy_SystemViews || diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Baselined/BaselinedTest.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Baselined/BaselinedTest.cs index 60ead92e..219a464d 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Baselined/BaselinedTest.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Baselined/BaselinedTest.cs @@ -54,8 +54,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common.Baselined private string _baselineSubDir = string.Empty; - public const string TestScriptDirectory = @"Testscripts\"; - public const string BaselineDirectory = @"Baselines\"; + public const string TestScriptDirectory = @"Testscripts"; + public const string BaselineDirectory = @"Baselines"; /// /// Gets/Sets the extension for the Testscript files diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/generateSQLConnectionSettings.sh b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/generateSQLConnectionSettings.sh new file mode 100644 index 00000000..f9f18796 --- /dev/null +++ b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/generateSQLConnectionSettings.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +WORKINGDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +dotnet restore $WORKINGDIR +dotnet restore $WORKINGDIR../../src/Microsoft.SqlTools.ServiceLayer/project.json +dotnet build $WORKINGDIR../../src/Microsoft.SqlTools.ServiceLayer\project.json +cd .. +dotnet restore +dotnet build Microsoft.SqlTools.ServiceLayer.TestDriver/project.json +dotnet build Microsoft.SqlTools.ServiceLayer.Test.Common/project.json +dotnet build Microsoft.SqlTools.ServiceLayer.TestEnvConfig/project.json + +cd Microsoft.SqlTools.ServiceLayer.TestEnvConfig + +dotnet run "$1" \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/TaskServices/TaskServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/TaskServices/TaskServiceTests.cs index ea585e99..df937fb6 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/TaskServices/TaskServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/TaskServices/TaskServiceTests.cs @@ -4,6 +4,7 @@ // using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.SqlTools.Extensibility; using Microsoft.SqlTools.Hosting.Protocol; @@ -56,6 +57,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.TaskServices serviceHostMock.Verify(x => x.SendEvent(TaskCreatedNotification.Type, It.Is(t => t.TaskId == sqlTask.TaskId.ToString() && t.ProviderName == "MSSQL")), Times.Once()); operation.Stop(); + Thread.Sleep(2000); serviceHostMock.Verify(x => x.SendEvent(TaskStatusChangedNotification.Type, It.Is(t => t.TaskId == sqlTask.TaskId.ToString())), Times.AtLeastOnce());