Ejemplo n.º 1
0
        public async Task ShouldFindSpecificIntegrationTestInstance()
        {
            var query    = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var instance = await query.Execute(DefaultTestCloudOdsInstance.FriendlyName);

            ValidateAgainstDefaultTestInstance(instance);
        }
        private async Task ShouldExecute(CloudOdsApiOperationContext context)
        {
            var token = await GetAccessTokenCredentialsAsync();

            var site = await GetApiWebsiteAsync(context.TargetEnvironment);

            var client = new WebSiteManagementClient(token)
            {
                SubscriptionId = DefaultAzureActiveDirectoryClientInfo.SubscriptionId
            };
            var settings = await client.Sites.ListSiteAppSettingsAsync(DefaultTestCloudOdsInstance.SystemName, site.Name);

            settings.Properties[CloudOdsApiWebsiteSettings.BearerTokenTimeoutSettingName] = "20";
            settings.Properties[CloudOdsApiWebsiteSettings.LogLevelSettingName]           = LogLevel.Warn.DisplayName;

            await client.Sites.UpdateSiteAppSettingsAsync(DefaultTestCloudOdsInstance.SystemName, site.Name, settings);

            var getAzureCloudOdsHostedInstanceQuery = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var getWebsiteQuery = new GetAzureCloudOdsHostedComponentsQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);
            var query           = new GetAzureCloudOdsApiWebsiteSettingsQuery(DefaultAzureActiveDirectoryClientInfo,
                                                                              getWebsiteQuery, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);

            var result = await query.Execute(context);

            result.BearerTokenTimeoutInMinutes.ShouldBe(20);
            result.LogLevel.ShouldBe(LogLevel.Warn);
        }
Ejemplo n.º 3
0
        public async Task ShouldMatchExpectedIntegrationTestValues()
        {
            var query     = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var instances = await query.Execute();

            var instance = instances.Single(i => i.FriendlyName.Equals(DefaultTestCloudOdsInstance.FriendlyName, StringComparison.InvariantCultureIgnoreCase));

            ValidateAgainstDefaultTestInstance(instance);
        }
Ejemplo n.º 4
0
        public async Task ShouldGetAllApiSites()
        {
            var getAzureCloudOdsHostedInstanceQuery = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var query   = new GetAzureCloudOdsHostedComponentsQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);
            var context = new CloudOdsOperationContext
            {
                Instance          = DefaultTestCloudOdsInstance,
                TargetEnvironment = null,
                TargetRole        = CloudOdsRole.Api
            };

            var result = await query.Execute(context);

            result.Count().ShouldBe(2);
            result.Count(w => w.IsProductionApi()).ShouldBe(1);
        }
        public async Task ShouldExecute()
        {
            var getAzureCloudOdsHostedInstanceQuery = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var websiteQuery     = new GetAzureCloudOdsHostedComponentsQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, getAzureCloudOdsHostedInstanceQuery);
            var performanceQuery = new GetAzureCloudOdsWebsitePerformanceLevelQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache, websiteQuery, getAzureCloudOdsHostedInstanceQuery);

            var context = new CloudOdsOperationContext
            {
                Instance          = DefaultTestCloudOdsInstance,
                TargetEnvironment = CloudOdsEnvironment.Production,
                TargetRole        = CloudOdsRole.Api
            };

            var result = await performanceQuery.Execute(context);

            result.Equals(AzureWebsitePerformanceLevel.Free).ShouldBeTrue();
        }
Ejemplo n.º 6
0
        public async Task ShouldIgnoreNonOdsResourceGroups()
        {
            var token = await GetAccessTokenCredentialsAsync();

            var client = new ResourceManagementClient(token)
            {
                SubscriptionId = DefaultAzureActiveDirectoryClientInfo.SubscriptionId
            };

            var testResourceGroupName = $"cloud_ods_integration_test_{DateTime.Now.ToString("yyyyMMddHHmmss")}";

            var query     = new GetAzureCloudOdsHostedInstanceQuery(DefaultAzureActiveDirectoryClientInfo, DefaultTokenCache);
            var instances = await query.Execute();

            instances.Any(i => i.SystemName.Equals(testResourceGroupName, StringComparison.InvariantCultureIgnoreCase)).ShouldBeFalse();

            await client.ResourceGroups.DeleteAsync(testResourceGroupName);
        }