public static void Initialize(TestContext testContext, bool useHttps) { string storageAccountName = Test.Data.Get("StorageAccountName"); string storageAccountKey = Test.Data.Get("StorageAccountKey"); string storageEndPoint = Test.Data.Get("StorageEndPoint"); string connectionString = Utility.GenConnectionString(storageAccountName, storageAccountKey, useHttps, storageEndPoint); SetUpStorageAccount = CloudStorageAccount.Parse(connectionString); CLICommonBVT.CLICommonBVTInitialize(testContext); if (lang == Language.PowerShell) { Environment.SetEnvironmentVariable(EnvKey, SetUpStorageAccount.ToString(true)); } else if (lang == Language.NodeJS) { switch (NodeJSAgent.AgentOSType) { case OSType.Windows: Environment.SetEnvironmentVariable(EnvKey, SetUpStorageAccount.ToString(true)); break; case OSType.Linux: case OSType.Mac: NodeJSAgent.AgentConfig.ConnectionString = SetUpStorageAccount.ToString(true); break; } NodeJSAgent.AgentConfig.UseEnvVar = true; } Test.Info("set env var {0} = {1}", EnvKey, SetUpStorageAccount.ToString(true)); }
public static void Initialize(TestContext testContext, bool useHttps) { SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig(useHttps: useHttps); CLICommonBVT.CLICommonBVTInitialize(testContext); NodeJSAgent.AgentConfig.ConnectionString = SetUpStorageAccount.ToString(true); NodeJSAgent.AgentConfig.UseEnvVar = false; }
public static void EnvConnectionStringHTTPBVTClassInitialize(TestContext testContext) { //first set the storage account //second init common bvt //third set storage context in powershell useHttps = false; SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig(string.Empty, useHttps); CLICommonBVT.CLICommonBVTInitialize(testContext); System.Environment.SetEnvironmentVariable(EnvKey, SetUpStorageAccount.ToString(true)); }
public static void ConnectionStringBVTClassInitialize(TestContext testContext) { //first set the storage account //second init common bvt //third set storage context in powershell SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig(); CLICommonBVT.CLICommonBVTInitialize(testContext); PowerShellAgent.SetStorageContext(SetUpStorageAccount.ToString(true)); useHttps = true; }
public static void SecondaryEndPointBVTClassInitialize(TestContext testContext) { //first set the storage account //second init common bvt //third set storage context in powershell useHttps = true; isSecondary = true; SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig("Secondary", useHttps); StorageAccountName = SetUpStorageAccount.Credentials.AccountName; string StorageEndPoint = Test.Data.Get("SecondaryStorageEndPoint"); CLICommonBVT.CLICommonBVTInitialize(testContext); PowerShellAgent.SetStorageContext(SetUpStorageAccount.ToString(true)); }
/// <summary> /// Create a container and then get it using powershell cmdlet /// </summary> /// <returns>A CloudBlobContainer object which is returned by PowerShell</returns> protected CloudBlobContainer CreateAndPsGetARandomContainer() { string containerName = Utility.GenNameString("bvt"); CloudBlobContainer container = SetUpStorageAccount.CreateCloudBlobClient().GetContainerReference(containerName); container.CreateIfNotExists(); try { PowerShellAgent agent = new PowerShellAgent(); Test.Assert(agent.GetAzureStorageContainer(containerName), Utility.GenComparisonData("GetAzureStorageContainer", true)); int count = 1; Test.Assert(agent.Output.Count == count, string.Format("get container should return only 1 container, actully it's {0}", agent.Output.Count)); return((CloudBlobContainer)agent.Output[0]["CloudBlobContainer"]); } finally { // clean up container.DeleteIfExists(); } }
public static void ClassInitialize(TestContext testContext, bool useHttps) { //first set the storage account //second init common bvt //third set storage context in powershell isSecondary = true; SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig("Secondary", useHttps); StorageAccountName = SetUpStorageAccount.Credentials.AccountName; string StorageEndPoint = Test.Data.Get("SecondaryStorageEndPoint"); CLICommonBVT.CLICommonBVTInitialize(testContext); Agent.Context = SetUpStorageAccount; if (lang == Language.PowerShell) { PowerShellAgent.SetStorageContext(SetUpStorageAccount.ToString(true)); } else { NodeJSAgent.AgentConfig.UseEnvVar = false; NodeJSAgent.AgentConfig.AccountName = StorageAccountName; NodeJSAgent.AgentConfig.AccountKey = SetUpStorageAccount.Credentials.ExportBase64EncodedKey(); } }