Esempio n. 1
0
        public static void EnvNameKeyBVTClassInitialize(TestContext testContext)
        {
            useHttps = true;
            //set the storage account
            SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig(useHttps: useHttps);

            //second init common bvt
            CLICommonBVT.CLICommonBVTInitialize(testContext);

            //remove env connection string
            System.Environment.SetEnvironmentVariable(EnvKey, string.Empty);

            //set account name & key
            string StorageAccountName = Test.Data.Get("StorageAccountName");
            string StorageAccountKey  = Test.Data.Get("StorageAccountKey");

            if (NodeJSAgent.AgentOSType == OSType.Windows)
            {
                Environment.SetEnvironmentVariable("AZURE_STORAGE_ACCOUNT", StorageAccountName);
                Environment.SetEnvironmentVariable("AZURE_STORAGE_ACCESS_KEY", StorageAccountKey);
            }
            else if (NodeJSAgent.AgentOSType == OSType.Linux || NodeJSAgent.AgentOSType == OSType.Mac)
            {
                NodeJSAgent.AgentConfig.AccountName = StorageAccountName;
                NodeJSAgent.AgentConfig.AccountKey  = StorageAccountKey;
            }
            NodeJSAgent.AgentConfig.UseEnvVar = true;
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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");
            string StorageAccountKey = Test.Data.Get("SecondaryStorageAccountKey");

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            Agent.Context = SetUpStorageAccount;

            if (lang == Language.PowerShell)
            {
                string azureEnvironmentName = PowerShellAgent.AddRandomAzureEnvironment(StorageEndpoint, "bvt");
                PowerShellAgent.SetStorageContextWithAzureEnvironment(StorageAccountName, StorageAccountKey, useHttps, azureEnvironmentName);
            }
            else
            {
                NodeJSAgent.AgentConfig.UseEnvVar   = false;
                NodeJSAgent.AgentConfig.AccountName = StorageAccountName;
                NodeJSAgent.AgentConfig.AccountKey  = StorageAccountKey;
            }
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 public static void SubScriptionBVTClassInitialize(TestContext testContext)
 {
     //first set the storage account
     //second init common bvt
     //third set storage context in powershell
     SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig();
     CLICommonBVT.CLICommonBVTInitialize(testContext);
     SetupSubscription();
 }
Esempio n. 6
0
 public static void AzureEmulatorBVTClassInitialize(TestContext testContext)
 {
     //first set the storage account
     //second init common bvt
     //third set storage context in powershell
     SetUpStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
     CLICommonBVT.CLICommonBVTInitialize(testContext);
     PowerShellAgent.SetLocalStorageContext();
     StartStorageEmulator();
 }
 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;
        }
Esempio n. 9
0
 public static void AnonymousBVTClassInitialize(TestContext testContext)
 {
     TestBase.TestClassInitialize(testContext);
     CLICommonBVT.SaveAndCleanSubScriptionAndEnvConnectionString();
     StorageAccountName = Test.Data.Get("StorageAccountName");
     StorageEndPoint    = Test.Data.Get("StorageEndPoint").Trim();
     useHttps           = true;
     PowerShellAgent.SetAnonymousStorageContext(StorageAccountName, useHttps, StorageEndPoint);
     downloadDirRoot = Test.Data.Get("DownloadDir");
     SetupDownloadDir();
 }
Esempio n. 10
0
        public void GetMooncakeStorageContext()
        {
            CLICommonBVT.SaveAndCleanSubScriptionAndEnvConnectionString();

            PowerShellAgent.ImportAzureSubscriptionAndSetStorageAccount(
                Test.Data.Get("MooncakeSubscriptionPath"),
                Test.Data.Get("MooncakeSubscriptionName"),
                null);

            ValidateStorageContext(Test.Data.Get("MooncakeStorageAccountName"), Test.Data.Get("MooncakeStorageAccountKey"), "core.chinacloudapi.cn");
        }
Esempio n. 11
0
        public static void SubScriptionBVTClassInitialize(TestContext testContext)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            string ConnectionString = Test.Data.Get("StorageConnectionString");

            SetUpStorageAccount = CloudStorageAccount.Parse(ConnectionString);

            CLICommonBVT.CLICommonBVTInitialize(testContext);

            SetupSubscription();
        }
Esempio n. 12
0
        public static void ConnectionStringHTTPBVTClassInitialize(TestContext testContext)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            string ConnectionString = Test.Data.Get("HTTPConnectionString");

            SetUpStorageAccount = CloudStorageAccount.Parse(ConnectionString);

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            PowerShellAgent.SetStorageContext(ConnectionString);
            useHttps = false;
        }
Esempio n. 13
0
        public static void EnvConnectionStringHTTPBVTClassInitialize(TestContext testContext)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            string ConnectionString = Test.Data.Get("HTTPEnvConnectionString");

            SetUpStorageAccount = CloudStorageAccount.Parse(ConnectionString);

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            System.Environment.SetEnvironmentVariable(EnvKey, ConnectionString);
            useHttps = false;
        }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
        public static void NameKeyContextBVTClassInitialize(TestContext testContext)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            StorageAccountName = Test.Data.Get("StorageAccountName");
            StorageAccountKey  = Test.Data.Get("StorageAccountKey");
            StorageCredentials credential = new StorageCredentials(StorageAccountName, StorageAccountKey);

            useHttps            = true;
            SetUpStorageAccount = new CloudStorageAccount(credential, useHttps);

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            PowerShellAgent.SetStorageContext(StorageAccountName, StorageAccountKey, useHttps);
        }
Esempio n. 16
0
        public static void Initialize(TestContext testContext, bool useHttps)
        {
            StorageAccount = null;
            TestBase.TestClassInitialize(testContext);
            CLICommonBVT.SaveAndCleanSubScriptionAndEnvConnectionString();
            StorageAccountName = Test.Data.Get("StorageAccountName");
            StorageEndPoint    = Test.Data.Get("StorageEndPoint").Trim();

            if (lang == Language.PowerShell)
            {
                PowerShellAgent.SetAnonymousStorageContext(StorageAccountName, useHttps, StorageEndPoint);
            }

            downloadDirRoot = Test.Data.Get("DownloadDir");
            SetupDownloadDir();
        }
Esempio n. 17
0
        public static void AzureEnvironmentBVTClassInitialize(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");
            string StorageAccountKey = Test.Data.Get("SecondaryStorageAccountKey");

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            azureEnvironmentName = PowerShellAgent.AddRandomAzureEnvironment(StorageEndpoint, "bvt");
            PowerShellAgent.SetStorageContextWithAzureEnvironment(StorageAccountName, StorageAccountKey, useHttps, azureEnvironmentName);
        }
        public static void NameKeyContextHTTPBVTClassInitialize(TestContext testContext)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            StorageAccountName = Test.Data.Get("StorageAccountName");
            string             StorageAccountKey = Test.Data.Get("StorageAccountKey");
            string             StorageEndPoint   = Test.Data.Get("StorageEndPoint");
            StorageCredentials credential        = new StorageCredentials(StorageAccountName, StorageAccountKey);

            useHttps            = false;
            isSecondary         = false;
            SetUpStorageAccount = Utility.GetStorageAccountWithEndPoint(credential, useHttps, StorageEndPoint);

            CLICommonBVT.CLICommonBVTInitialize(testContext);
            PowerShellAgent.SetStorageContext(StorageAccountName, StorageAccountKey, useHttps, StorageEndPoint);
        }
Esempio n. 19
0
        public static void Initialize(TestContext testContext, bool useHttps)
        {
            //first set the storage account
            //second init common bvt
            //third set storage context in powershell
            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)
            {
                PowerShellAgent.SetStorageContext(connectionString);
            }
        }
Esempio n. 20
0
        public static void ParamNameKeyBVTClassInitialize(TestContext testContext)
        {
            useHttps = true;
            //set the storage account
            SetUpStorageAccount = TestBase.GetCloudStorageAccountFromConfig(useHttps: useHttps);

            //second init common bvt
            CLICommonBVT.CLICommonBVTInitialize(testContext);

            //remove env connection string
            System.Environment.SetEnvironmentVariable(EnvKey, string.Empty);

            //set account name & key
            string StorageAccountName = Test.Data.Get("StorageAccountName");
            string StorageAccountKey  = Test.Data.Get("StorageAccountKey");

            NodeJSAgent.AgentConfig.AccountName = StorageAccountName;
            NodeJSAgent.AgentConfig.AccountKey  = StorageAccountKey;
            NodeJSAgent.AgentConfig.UseEnvVar   = false;
        }
Esempio n. 21
0
        public static void InvalidCredentialCasesClassInit(TestContext testContext)
        {
            StorageAccount = null;
            TestBase.TestClassInitialize(testContext);
            CLICommonBVT.SaveAndCleanSubScriptionAndEnvConnectionString();
            string storageAccountName = Test.Data.Get("StorageAccountName");
            string storageEndPoint    = Test.Data.Get("StorageEndPoint").Trim();

            Agent.Context = StorageAccount;

            if (lang == Language.PowerShell)
            {
                PowerShellAgent.SetAnonymousStorageContext(storageAccountName, useHttps, storageEndPoint);
            }
            else
            {
                NodeJSAgent.AgentConfig.ConnectionString = null;
                PreviousUseEnvVar = NodeJSAgent.AgentConfig.UseEnvVar;
                NodeJSAgent.AgentConfig.UseEnvVar = true;
            }
        }
Esempio n. 22
0
        public void RunCmdletWithoutStorageContext()
        {
            PowerShellAgent.RemoveAzureSubscriptionIfExists();

            CLICommonBVT.SaveAndCleanSubScriptionAndEnvConnectionString();

            string             containerName = Utility.GenNameString("container");
            CloudBlobContainer container     = blobUtil.CreateContainer(containerName);

            try
            {
                bool terminated = false;

                try
                {
                    agent.GetAzureStorageContainer(containerName);
                }
                catch (CmdletInvocationException e)
                {
                    terminated = true;
                    Test.Info(e.Message);
                    Test.Assert(e.Message.StartsWith("Can not find your azure storage credential."), "Can not find your azure storage credential.");
                }
                finally
                {
                    if (!terminated)
                    {
                        Test.AssertFail("without storage context should return a terminating error");
                    }
                }
            }
            finally
            {
                blobUtil.RemoveContainer(containerName);
            }

            CLICommonBVT.RestoreSubScriptionAndEnvConnectionString();
        }
Esempio n. 23
0
        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();
            }
        }
Esempio n. 24
0
 public static void OAuthBVTCleanup()
 {
     CLICommonBVT.CLICommonBVTCleanup();
 }
 public static void EnvConnectionStringHTTPBVTCleanUp()
 {
     CLICommonBVT.CLICommonBVTCleanup();
 }
Esempio n. 26
0
 public static void NameKeyContextBVTCleanup()
 {
     CLICommonBVT.CLICommonBVTCleanup();
 }
Esempio n. 27
0
 public static void AzureEnvironmentBVTCleanup()
 {
     CLICommonBVT.CLICommonBVTCleanup();
     PowerShellAgent.RemoveAzureEnvironment(azureEnvironmentName);
 }
Esempio n. 28
0
 public static void ParamConnectionStringBVTCleanUp()
 {
     CLICommonBVT.CLICommonBVTCleanup();
 }
Esempio n. 29
0
 public static void AzureEmulatorBVTCleanup()
 {
     StopStorageEmulator();
     CLICommonBVT.CLICommonBVTCleanup();
 }
Esempio n. 30
0
 public static void SecondaryEndPointBVTCleanup()
 {
     CLICommonBVT.CLICommonBVTCleanup();
 }