diff --git a/azure-pipelines/integrationtests.yml b/azure-pipelines/integrationtests.yml index 5851fb2d..779112ef 100644 --- a/azure-pipelines/integrationtests.yml +++ b/azure-pipelines/integrationtests.yml @@ -14,10 +14,10 @@ steps: - script: docker pull mcr.microsoft.com/mssql/server:2022-latest displayName: Pull MSSQL Docker Image - - bash: echo "##vso[task.setvariable variable=defaultSql2022_password;issecret=true]Test-$(Build.BuildNumber)-$(Get-Date -format yyyyMMdd-Hmmss)" + - bash: echo "##vso[task.setvariable variable=sqlOnPrem_password;issecret=true]Test-$(Build.BuildNumber)-$(Get-Date -format yyyyMMdd-Hmmss)" displayName: Generate password for test server - - script: 'docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$(defaultSql2022_password)" -e "MSSQL_AGENT_ENABLED=True" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest' + - script: 'docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$(sqlOnPrem_password)" -e "MSSQL_AGENT_ENABLED=True" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest' displayName: Starting Server in Docker Container - task: UseDotNet@2 @@ -37,21 +37,25 @@ steps: inputs: projects: '**/Microsoft.SqlTools.ServiceLayer.TestEnvConfig.csproj' - - task: DownloadSecureFile@1 - displayName: Download Test Environment Configuration - name: testEnvironmentPath - inputs: - secureFile: 'SQLConnectionInstances.xml' + - bash: 'echo " + + + localhost + sa + + + " > test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstances.xml' + displayName: 'Writing test environment config file' - task: DotNetCoreCLI@2 displayName: Setting Up Test Environment inputs: command: run - projects: '**/Microsoft.SqlTools.ServiceLayer.TestEnvConfig.csproj' - arguments: $(testEnvironmentPath.secureFilePath) + projects: 'test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Microsoft.SqlTools.ServiceLayer.TestEnvConfig.csproj' + arguments: 'test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstances.xml' testRunTitle: 'Setting tests' env: - defaultSql2022_password: '$(defaultSql2022_password)' + sqlOnPrem_password: '$(sqlOnPrem_password)' - task: AzureKeyVault@1 displayName: 'Azure Key Vault: SqlToolsSecretStore' diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConfigPersistenceHelper.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConfigPersistenceHelper.cs index d54b9153..1edc932f 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConfigPersistenceHelper.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConfigPersistenceHelper.cs @@ -25,7 +25,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common /// "user": "sa", /// "password": "[putvaluehere]", /// "serverType":"OnPrem", - /// "VersionKey": "defaultSql2016" + /// "VersionKey": "sqlOnPrem" /// } /// ] /// } diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConnectionProfileService.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConnectionProfileService.cs index 541ebe11..2db5727f 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConnectionProfileService.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/TestConnectionProfileService.cs @@ -21,19 +21,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common private static Dictionary connectionProfilesCache = new Dictionary(); private static TestConnectionProfileService instance = new TestConnectionProfileService(); - public const string DefaultSql2005InstanceKey = "defaultSql2005"; - public const string DefaultSql2008InstanceKey = "defaultSql2008"; - public const string DefaultSql2011InstanceKey = "defaultSql2011"; - public const string DefaultSql2012Pcu1InstanceKey = "defaultSql2012pcu1"; - public const string DefaultSql2014InstanceKey = "defaultSql2014"; - public const string DefaultSqlAzureInstanceKey = "defaultSqlAzure"; - public const string DefaultServerlessInstanceKey = "defaultServerless"; - public const string DefaultSqlPdwInstanceKey = "defaultSqlPdw"; - public const string DefaultSqlAzureV12InstanceKey = "defaultSqlAzureV12"; - public const string DefaultSql2016InstanceKey = "defaultSql2016"; - public const string DefaultSql2019InstanceKey = "defaultSql2019"; - public const string DefaultSql2022InstanceKey = "defaultSql2022"; - public const string DefaultSqlvNextInstanceKey = "defaultSqlvNext"; + public const string SqlAzureInstanceKey = "sqlAzure"; + public const string SqlOnPremInstanceKey = "sqlOnPrem"; private TestConnectionProfileService() { @@ -48,44 +37,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common } } - public static InstanceInfo DefaultSql2012Pcu1 + public static InstanceInfo SqlAzure { - get { return GetInstance(DefaultSql2012Pcu1InstanceKey); } + get { return GetInstance(SqlAzureInstanceKey); } } - public static InstanceInfo DefaultSql2014 + public static InstanceInfo SqlOnPrem { - get { return GetInstance(DefaultSql2014InstanceKey); } - } - - public static InstanceInfo DefaultSqlAzure - { - get { return GetInstance(DefaultSqlAzureInstanceKey); } - } - - public static InstanceInfo DefaultSqlAzureV12 - { - get { return GetInstance(DefaultSqlAzureV12InstanceKey); } - } - - public static InstanceInfo DefaultSql2016 - { - get { return GetInstance(DefaultSql2016InstanceKey); } - } - - public static InstanceInfo DefaultSql2019 - { - get { return GetInstance(DefaultSql2019InstanceKey); } - } - - public static InstanceInfo DefaultSql2022 - { - get { return GetInstance(DefaultSql2022InstanceKey); } - } - - public static InstanceInfo DefaultSqlvNext - { - get { return GetInstance(DefaultSqlvNextInstanceKey); } + get { return GetInstance(SqlOnPremInstanceKey); } } /// @@ -99,7 +58,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common return instanceInfo; } - public ConnectParams GetConnectionParameters(string key = DefaultSql2022InstanceKey, string databaseName = null) + public ConnectParams GetConnectionParameters(string key = SqlOnPremInstanceKey, string databaseName = null) { InstanceInfo instanceInfo = GetInstance(key); if (instanceInfo != null) @@ -192,7 +151,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common private static string ConvertServerTypeToVersionKey(TestServerType serverType) { - return serverType == TestServerType.OnPrem ? DefaultSql2022InstanceKey : DefaultSqlAzureV12InstanceKey; + return serverType == TestServerType.OnPrem ? SqlOnPremInstanceKey : SqlAzureInstanceKey; } /// @@ -214,7 +173,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common connectParams.Connection.DatabaseName = databaseName; connectParams.Connection.DatabaseDisplayName = databaseName; } - if (key == DefaultSqlAzureInstanceKey || key == DefaultSqlAzureV12InstanceKey) + if (key == SqlAzureInstanceKey || key == SqlAzureInstanceKey) { connectParams.Connection.ConnectTimeout = 30; connectParams.Connection.Encrypt = true; diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs index 17e75e16..4c9d91f6 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/Program.cs @@ -67,23 +67,13 @@ namespace Microsoft.SqlTools.ServiceLayer.TestEnvConfig The following is an example of a setting_file: - - SQL2005 servername + + SQL On-Prem servername RemoteShare - SQL 2005 remote share + SQL remote share - - SQL2008 servername - RemoteShare - SQL 2008 remote share - - - SQL2011 servername - RemoteShare - SQL 20011 remote share - - - SQLAzure servername + + SQL Azure servername RemoteShare SQLAzure remote share user id diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstancesTemplate.xml b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstancesTemplate.xml index 8915b031..81de107d 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstancesTemplate.xml +++ b/test/Microsoft.SqlTools.ServiceLayer.TestEnvConfig/SQLConnectionInstancesTemplate.xml @@ -1,11 +1,11 @@ - + [server name] [user name for SQL authentication] [password for SQL authentication] - + [server name] [user name for SQL authentication] [password for SQL authentication]