Fixing integration tests for sts (#1453)

* Fixing test pipeline

* pwd

* fixing script

* fixing cwd

* switch to bash

* Cleaning up script and yml

* Fixing script comment

* Fixing the comments

* Adding issue in the comment

* Adding automatic password generator

* Removing unncesary use statement

* Fixing key

* Printing var

* Printing settings

* Printing var

* Fixed var

* Fixed

* Reverting some changes

* Changing fetch variable to upper case

* Fixing password logic

* Debug

* debug2

* debug

* Making passwords secret

* Fixing string null check

* removed dirs

* fixing var name

* Fixing var

* Printing  vars to see if the enviornment is setup correctly

* Printing versionkey

* removing prints

* Adding 2019 Instance key and updating template

* fixing env variable

* Fixing comment
This commit is contained in:
Aasim Khan
2022-04-08 15:19:49 -07:00
committed by GitHub
parent b1f494d04d
commit cc63d866d7
5 changed files with 170 additions and 42 deletions

View File

@@ -5,9 +5,9 @@
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.SqlTools.ServiceLayer.Test.Common;
using System.Collections.Generic;
namespace Microsoft.SqlTools.ServiceLayer.TestEnvConfig
{
@@ -94,22 +94,25 @@ namespace Microsoft.SqlTools.ServiceLayer.TestEnvConfig
private static void SaveSettings(string settingFile)
{
var xdoc = XDocument.Load(settingFile);
var settings =
from setting in xdoc.Descendants("Instance")
select new InstanceInfo(setting.Attribute("VersionKey").Value) // VersionKey is required
List<InstanceInfo> settings = new List<InstanceInfo>();
foreach (var setting in xdoc.Descendants("Instance"))
{
var passwordEnvVariableValue = Environment.GetEnvironmentVariable((setting.Attribute("VersionKey").Value + "_password"));
settings.Add(new InstanceInfo(setting.Attribute("VersionKey").Value)
{
ServerName = setting.Element("DataSource").Value, // DataSource is required
ConnectTimeoutAsString = (string)setting.Element("ConnectTimeout"), //ConnectTimeout is optional
User = (string)setting.Element("UserId"), // UserID is optional
Password = (string)setting.Element("Password"),
Password = string.IsNullOrEmpty(passwordEnvVariableValue) ? (string)setting.Element("Password") : passwordEnvVariableValue,
RemoteSharePath = (string)setting.Element("RemoteShare"), // RemoteShare is optional
AuthenticationType = string.IsNullOrEmpty((string)setting.Element("UserId")) ? AuthenticationType.Integrated : AuthenticationType.SqlLogin
};
});
}
TestConfigPersistenceHelper.Write(settings);
}
}
}

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Instances>
<Instance VersionKey="defaultSql2019">
<DataSource>[server name]</DataSource>
<UserId>[user name for SQL authentication]</UserId>
<Password>[password for SQL authentication]</Password>
</Instance>
<Instance VersionKey="defaultSql2016">
<DataSource>[server name]</DataSource>
<UserId>[user name for SQL authentication]</UserId>