public async Task Test_DeallocateVm_LiveVM()
 {
     using (var client = ManagementClient.CreateComputeClient())
     {
         await client.DeallocateVmAsync(VmName);
     }
 }
        public async Task Test_CheckCreateCloudService_WithNewService()
        {
            using (var client = ManagementClient.CreateComputeClient())
            {
                var parameters =
                    new HostedServiceCreateParameters
                {
                    Label       = "Integration Test",
                    Location    = LocationNames.NorthEurope,
                    ServiceName = "fct-" + Guid.NewGuid().ToString().Split('-').Last()
                };

                try
                {
                    await client.CreateServiceIfNotExistsAsync(parameters);

                    var service = await client.HostedServices.GetAsync(parameters.ServiceName);

                    Assert.IsNotNull(service);
                }
                finally
                {
                    client.HostedServices.Delete(parameters.ServiceName);
                }
            }
        }
 public async Task Test_ResizeVm_DownscaleA1_LiveVM()
 {
     using (var client = ManagementClient.CreateComputeClient())
     {
         await client.ResizeVmAsync(VmName, VirtualMachineSize.Small.GetEnumDescription());
     }
 }
        public async Task Test_ListVmsAsync_LiveSubscription()
        {
            using (var client = ManagementClient.CreateComputeClient())
            {
                var vms = (await client.ListVmsAsync()).ToList();

                Assert.IsTrue(vms.Any());
            }
        }
Пример #5
0
        public async Task Test_AzureCloudService_ProvisionAll_End2End()
        {
            FlexDataConfiguration.Branch        = "Main";
            FlexDataConfiguration.Configuration = "MO";

            using (var client = ManagementClient.CreateComputeClient())
                using (var context = new DevOpsFlexDbContext())
                {
                    await context.Components.OfType <AzureCloudService>().ProvisionAllAsync(client);
                }
        }
        public void Test_AzureCloudService_ProvisionAll_End2End()
        {
            FlexDataConfiguration.Branch        = "Main";
            FlexDataConfiguration.Configuration = "MO";

            using (var client = ManagementClient.CreateComputeClient())
                using (var context = new DevOpsFlexDbContext())
                {
                    var tasks = context.Components.OfType <AzureCloudService>().ProvisionAllAsync(client);
                    Task.WaitAll(tasks.ToArray());
                }
        }
        public async Task Fix_Unused_PaaSDiagnostics_Extensions()
        {
            const string serviceName = "fct-servicebus-oat";

            using (var computeClient = ManagementClient.CreateComputeClient())
            {
                var diagnosticsExtensions = (await computeClient.HostedServices.ListExtensionsAsync(serviceName)).Where(e => e.Type == "PaaSDiagnostics").ToList();

                foreach (var ext in diagnosticsExtensions)
                {
                    try
                    {
                        await computeClient.HostedServices.DeleteExtensionAsync(serviceName, ext.Id);
                    }
                    catch (Exception)
                    {
                        // ignored - soaking used extension exceptions intentionally.
                    }
                }
            }
        }