diff --git a/src/Promitor.Agents.Scraper/Validation/Interfaces/IValidationStep.cs b/src/Promitor.Agents.Core/Validation/Interfaces/IValidationStep.cs similarity index 67% rename from src/Promitor.Agents.Scraper/Validation/Interfaces/IValidationStep.cs rename to src/Promitor.Agents.Core/Validation/Interfaces/IValidationStep.cs index 85f49bfd0..d39ce6265 100644 --- a/src/Promitor.Agents.Scraper/Validation/Interfaces/IValidationStep.cs +++ b/src/Promitor.Agents.Core/Validation/Interfaces/IValidationStep.cs @@ -1,4 +1,4 @@ -namespace Promitor.Agents.Scraper.Validation.Interfaces +namespace Promitor.Agents.Core.Validation.Interfaces { public interface IValidationStep { diff --git a/src/Promitor.Agents.Scraper/Validation/RuntimeValidator.cs b/src/Promitor.Agents.Core/Validation/RuntimeValidator.cs similarity index 62% rename from src/Promitor.Agents.Scraper/Validation/RuntimeValidator.cs rename to src/Promitor.Agents.Core/Validation/RuntimeValidator.cs index 81533fb4d..9eda56b22 100644 --- a/src/Promitor.Agents.Scraper/Validation/RuntimeValidator.cs +++ b/src/Promitor.Agents.Core/Validation/RuntimeValidator.cs @@ -1,41 +1,21 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Promitor.Agents.Scraper.Configuration; -using Promitor.Core.Scraping.Configuration.Providers.Interfaces; -using Promitor.Agents.Scraper.Validation.Interfaces; -using Promitor.Agents.Scraper.Validation.Steps; -using Promitor.Agents.Scraper.Validation.Steps.Sinks; -using Promitor.Core.Scraping.Configuration.Runtime; +using Promitor.Agents.Core.Validation.Interfaces; #pragma warning disable 618 -namespace Promitor.Agents.Scraper.Validation +namespace Promitor.Agents.Core.Validation { public class RuntimeValidator { private readonly ILogger _validationLogger; private readonly List _validationSteps; - public RuntimeValidator( - IOptions runtimeConfiguration, - IOptions metricsConfiguration, - ILogger validatorLogger, - IMetricsDeclarationProvider scrapeConfigurationProvider, - IConfiguration configuration) + public RuntimeValidator(IEnumerable validationSteps, + ILogger validatorLogger) { _validationLogger = validatorLogger; - - _validationSteps = new List - { - new ConfigurationPathValidationStep(metricsConfiguration, _validationLogger), - new AzureAuthenticationValidationStep(configuration, _validationLogger), - new MetricsDeclarationValidationStep(scrapeConfigurationProvider, _validationLogger), - new ResourceDiscoveryValidationStep(runtimeConfiguration.Value.ResourceDiscovery, scrapeConfigurationProvider, _validationLogger), - new StatsDMetricSinkValidationStep(runtimeConfiguration, _validationLogger), - new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration, _validationLogger) - }; + _validationSteps = validationSteps.ToList(); } /// diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/ValidationStep.cs b/src/Promitor.Agents.Core/Validation/Steps/ValidationStep.cs similarity index 81% rename from src/Promitor.Agents.Scraper/Validation/Steps/ValidationStep.cs rename to src/Promitor.Agents.Core/Validation/Steps/ValidationStep.cs index caf670061..fbd8bb4b9 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/ValidationStep.cs +++ b/src/Promitor.Agents.Core/Validation/Steps/ValidationStep.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Logging; -namespace Promitor.Agents.Scraper.Validation.Steps +namespace Promitor.Agents.Core.Validation.Steps { public class ValidationStep { diff --git a/src/Promitor.Agents.Scraper/Validation/ValidationResult.cs b/src/Promitor.Agents.Core/Validation/ValidationResult.cs similarity index 96% rename from src/Promitor.Agents.Scraper/Validation/ValidationResult.cs rename to src/Promitor.Agents.Core/Validation/ValidationResult.cs index cded32ddc..a144c2863 100644 --- a/src/Promitor.Agents.Scraper/Validation/ValidationResult.cs +++ b/src/Promitor.Agents.Core/Validation/ValidationResult.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Text; -namespace Promitor.Agents.Scraper.Validation +namespace Promitor.Agents.Core.Validation { public class ValidationResult { diff --git a/src/Promitor.Agents.Scraper/Docs/Open-Api.xml b/src/Promitor.Agents.Scraper/Docs/Open-Api.xml index 023686777..6093d73e3 100644 --- a/src/Promitor.Agents.Scraper/Docs/Open-Api.xml +++ b/src/Promitor.Agents.Scraper/Docs/Open-Api.xml @@ -72,18 +72,15 @@ - + - Checks whether Promitor's configuration is valid so that the application - can start running successfully. + Defines the dependencies that Promitor requires - - true if the configuration is valid, false otherwise. - + Collections of services in application - + - Defines the dependencies that Promitor requires + Defines the validation for when Promitor starts up Collections of services in application diff --git a/src/Promitor.Agents.Scraper/Extensions/IServiceCollectionExtensions.cs b/src/Promitor.Agents.Scraper/Extensions/IServiceCollectionExtensions.cs index 104378a60..fe0d1af74 100644 --- a/src/Promitor.Agents.Scraper/Extensions/IServiceCollectionExtensions.cs +++ b/src/Promitor.Agents.Scraper/Extensions/IServiceCollectionExtensions.cs @@ -5,6 +5,8 @@ using Promitor.Agents.Core.Configuration.Server; using Promitor.Agents.Core.Configuration.Telemetry; using Promitor.Agents.Core.Configuration.Telemetry.Sinks; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; using Promitor.Agents.Scraper; using Promitor.Agents.Scraper.Configuration; using Promitor.Agents.Scraper.Configuration.Sinks; @@ -15,7 +17,8 @@ using Promitor.Core.Scraping.Configuration.Serialization.v1.Core; using Promitor.Core.Scraping.Configuration.Serialization.v1.Model; using Promitor.Core.Scraping.Factories; -using Promitor.Agents.Scraper.Validation; +using Promitor.Agents.Scraper.Validation.Steps; +using Promitor.Agents.Scraper.Validation.Steps.Sinks; using Promitor.Core.Metrics; using Promitor.Core.Metrics.Sinks; using Promitor.Core.Scraping.Configuration.Runtime; @@ -42,7 +45,6 @@ public static IServiceCollection DefineDependencies(this IServiceCollection serv services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddSingleton(); @@ -61,6 +63,22 @@ public static IServiceCollection DefineDependencies(this IServiceCollection serv return services; } + /// + /// Defines the validation for when Promitor starts up + /// + /// Collections of services in application + public static IServiceCollection ConfigureValidation(this IServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + return services; + } /// /// Adds the required metric sinks diff --git a/src/Promitor.Agents.Scraper/Program.cs b/src/Promitor.Agents.Scraper/Program.cs index 320768fa8..2711ca3a8 100644 --- a/src/Promitor.Agents.Scraper/Program.cs +++ b/src/Promitor.Agents.Scraper/Program.cs @@ -6,7 +6,7 @@ using Promitor.Agents.Core; using Promitor.Agents.Core.Configuration.Server; using Promitor.Agents.Core.Extensions; -using Promitor.Agents.Scraper.Validation; +using Promitor.Agents.Core.Validation; using Promitor.Core; using Serilog; diff --git a/src/Promitor.Agents.Scraper/Startup.cs b/src/Promitor.Agents.Scraper/Startup.cs index e86c06fd1..99bdccf99 100644 --- a/src/Promitor.Agents.Scraper/Startup.cs +++ b/src/Promitor.Agents.Scraper/Startup.cs @@ -41,6 +41,7 @@ public void ConfigureServices(IServiceCollection services) .AddHttpCorrelation() .AddAutoMapper(typeof(V1MappingProfile).Assembly) .DefineDependencies() + .ConfigureValidation() .ConfigureYamlConfiguration(Configuration) .UseOpenApiSpecifications("Promitor - Scraper API v1", openApiDescription, 1); diff --git a/src/Promitor.Agents.Scraper/Validation/Exceptions/ValidationFailedException.cs b/src/Promitor.Agents.Scraper/Validation/Exceptions/ValidationFailedException.cs index f9722bb87..0e7587e17 100644 --- a/src/Promitor.Agents.Scraper/Validation/Exceptions/ValidationFailedException.cs +++ b/src/Promitor.Agents.Scraper/Validation/Exceptions/ValidationFailedException.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Promitor.Agents.Core.Validation; namespace Promitor.Agents.Scraper.Validation.Exceptions { diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/AzureAuthenticationValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/AzureAuthenticationValidationStep.cs index f2ce7729c..164fbcf08 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/AzureAuthenticationValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/AzureAuthenticationValidationStep.cs @@ -1,8 +1,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Core; -using Promitor.Agents.Scraper.Validation.Interfaces; namespace Promitor.Agents.Scraper.Validation.Steps { @@ -12,11 +13,7 @@ public class AzureAuthenticationValidationStep : ValidationStep, IValidationStep public string ComponentName { get; } = "Azure Authentication"; - public AzureAuthenticationValidationStep(IConfiguration configuration) : this(configuration, NullLogger.Instance) - { - } - - public AzureAuthenticationValidationStep(IConfiguration configuration, ILogger logger) : base(logger) + public AzureAuthenticationValidationStep(IConfiguration configuration, ILogger logger) : base(logger) { _configuration = configuration; } diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/ConfigurationPathValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/ConfigurationPathValidationStep.cs index 96ed5d349..a9e4cb0f0 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/ConfigurationPathValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/ConfigurationPathValidationStep.cs @@ -1,8 +1,9 @@ using System.IO; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; -using Promitor.Agents.Scraper.Validation.Interfaces; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Core.Scraping.Configuration.Runtime; namespace Promitor.Agents.Scraper.Validation.Steps @@ -12,12 +13,7 @@ public class ConfigurationPathValidationStep : ValidationStep, IValidationStep private readonly IOptions _metricsConfiguration; public string ComponentName { get; } = "Metrics Declaration Path"; - public ConfigurationPathValidationStep(IOptions metricsConfiguration) : this(metricsConfiguration, NullLogger.Instance) - { - _metricsConfiguration = metricsConfiguration; - } - - public ConfigurationPathValidationStep(IOptions metricsConfiguration, ILogger logger) : base(logger) + public ConfigurationPathValidationStep(IOptions metricsConfiguration, ILogger logger) : base(logger) { _metricsConfiguration = metricsConfiguration; } diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/MetricsDeclarationValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/MetricsDeclarationValidationStep.cs index 71c175677..ff2214ebe 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/MetricsDeclarationValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/MetricsDeclarationValidationStep.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Core.Scraping.Configuration.Model; using Promitor.Core.Scraping.Configuration.Model.Metrics; using Promitor.Core.Scraping.Configuration.Providers.Interfaces; using Promitor.Core.Scraping.Configuration.Serialization; using Promitor.Core.Serialization.Yaml; -using Promitor.Agents.Scraper.Validation.Interfaces; using Promitor.Agents.Scraper.Validation.MetricDefinitions; using Promitor.Core.Contracts.ResourceTypes; @@ -17,12 +18,8 @@ namespace Promitor.Agents.Scraper.Validation.Steps public class MetricsDeclarationValidationStep : ValidationStep, IValidationStep { private readonly IMetricsDeclarationProvider _metricsDeclarationProvider; - - public MetricsDeclarationValidationStep(IMetricsDeclarationProvider metricsDeclarationProvider) : this(metricsDeclarationProvider, NullLogger.Instance) - { - } - - public MetricsDeclarationValidationStep(IMetricsDeclarationProvider metricsDeclarationProvider, ILogger logger) : base( logger) + + public MetricsDeclarationValidationStep(IMetricsDeclarationProvider metricsDeclarationProvider, ILogger logger) : base( logger) { _metricsDeclarationProvider = metricsDeclarationProvider; } diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/ResourceDiscoveryValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/ResourceDiscoveryValidationStep.cs index b5dfddd13..4c820e883 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/ResourceDiscoveryValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/ResourceDiscoveryValidationStep.cs @@ -1,28 +1,25 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Agents.Scraper.Configuration; -using Promitor.Agents.Scraper.Validation.Interfaces; using Promitor.Core.Scraping.Configuration.Providers.Interfaces; -using Promitor.Core.Scraping.Configuration.Serialization; namespace Promitor.Agents.Scraper.Validation.Steps { public class ResourceDiscoveryValidationStep : ValidationStep, IValidationStep { private const string NoDiscoveryConfiguredError = "Resource discovery groups are defined in your metrics configuration, but resource discovery has not been configured in the runtime configuration. Please add a resource discovery configuration for Promitor Scraper runtime."; + private readonly IOptions _resourceDiscoveryConfiguration; private readonly IMetricsDeclarationProvider _metricsDeclarationProvider; - private readonly ResourceDiscoveryConfiguration _configuration; - public ResourceDiscoveryValidationStep(ResourceDiscoveryConfiguration configuration, IMetricsDeclarationProvider metricsDeclarationProvider) : this(configuration, metricsDeclarationProvider, NullLogger.Instance) - { - } - - public ResourceDiscoveryValidationStep(ResourceDiscoveryConfiguration configuration, IMetricsDeclarationProvider metricsDeclarationProvider, ILogger logger) : base( logger) + public ResourceDiscoveryValidationStep(IOptions resourceDiscoveryResourceDiscoveryConfiguration, IMetricsDeclarationProvider metricsDeclarationProvider, ILogger logger) : base( logger) { _metricsDeclarationProvider = metricsDeclarationProvider; - _configuration = configuration; + _resourceDiscoveryConfiguration = resourceDiscoveryResourceDiscoveryConfiguration; } public string ComponentName { get; } = "Resource Discovery"; @@ -30,7 +27,7 @@ public ResourceDiscoveryValidationStep(ResourceDiscoveryConfiguration configurat public ValidationResult Run() { var doesDeclareResourceDiscoveryGroups = DetermineIfDiscoveryGroupsAreDefined(); - if (_configuration == null) + if (_resourceDiscoveryConfiguration == null) { if (doesDeclareResourceDiscoveryGroups) { @@ -41,14 +38,14 @@ public ValidationResult Run() } var errorMessages = new List(); - if (string.IsNullOrWhiteSpace(_configuration.Host)) + if (string.IsNullOrWhiteSpace(_resourceDiscoveryConfiguration.Value.Host)) { errorMessages.Add( "No host name for resource discovery was configured"); } - if (_configuration.Port <= 0) + if (_resourceDiscoveryConfiguration.Value.Port <= 0) { - errorMessages.Add($"No valid port ({_configuration.Port}) for resource discovery was configured"); + errorMessages.Add($"No valid port ({_resourceDiscoveryConfiguration.Value.Port}) for resource discovery was configured"); } return errorMessages.Any() ? ValidationResult.Failure(ComponentName, errorMessages) : ValidationResult.Successful(ComponentName); @@ -56,8 +53,7 @@ public ValidationResult Run() private bool DetermineIfDiscoveryGroupsAreDefined() { - var errorReporter = new ErrorReporter(); - var metricsDeclaration = _metricsDeclarationProvider.Get(applyDefaults: true, errorReporter: errorReporter); + var metricsDeclaration = _metricsDeclarationProvider.Get(applyDefaults: true); return metricsDeclaration.Metrics.Any(metricDefinition => metricDefinition.ResourceDiscoveryGroups?.Count >= 1); } } diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/PrometheusScrapingEndpointMetricSinkValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/PrometheusScrapingEndpointMetricSinkValidationStep.cs index 40bff5406..13c5a7dff 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/PrometheusScrapingEndpointMetricSinkValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/PrometheusScrapingEndpointMetricSinkValidationStep.cs @@ -1,21 +1,16 @@ using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Agents.Scraper.Configuration; -using Promitor.Agents.Scraper.Validation.Interfaces; namespace Promitor.Agents.Scraper.Validation.Steps.Sinks { public class PrometheusScrapingEndpointMetricSinkValidationStep : ValidationStep, IValidationStep { private readonly IOptions _runtimeConfiguration; - - public PrometheusScrapingEndpointMetricSinkValidationStep(IOptions runtimeConfiguration) - : this(runtimeConfiguration, NullLogger.Instance) - { - } - - public PrometheusScrapingEndpointMetricSinkValidationStep(IOptions runtimeConfiguration, ILogger validationLogger) + public PrometheusScrapingEndpointMetricSinkValidationStep(IOptions runtimeConfiguration, ILogger validationLogger) : base(validationLogger) { _runtimeConfiguration = runtimeConfiguration; diff --git a/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/StatsDMetricSinkValidationStep.cs b/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/StatsDMetricSinkValidationStep.cs index 5b9d1ac95..30f2d27d7 100644 --- a/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/StatsDMetricSinkValidationStep.cs +++ b/src/Promitor.Agents.Scraper/Validation/Steps/Sinks/StatsDMetricSinkValidationStep.cs @@ -1,10 +1,11 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; +using Promitor.Agents.Core.Validation; +using Promitor.Agents.Core.Validation.Interfaces; +using Promitor.Agents.Core.Validation.Steps; using Promitor.Agents.Scraper.Configuration; -using Promitor.Agents.Scraper.Validation.Interfaces; namespace Promitor.Agents.Scraper.Validation.Steps.Sinks { @@ -13,12 +14,7 @@ public class StatsDMetricSinkValidationStep : ValidationStep, { private readonly IOptions _runtimeConfiguration; - public StatsDMetricSinkValidationStep(IOptions runtimeConfiguration) - : this(runtimeConfiguration, NullLogger.Instance) - { - } - - public StatsDMetricSinkValidationStep(IOptions runtimeConfiguration, ILogger validationLogger) + public StatsDMetricSinkValidationStep(IOptions runtimeConfiguration, ILogger validationLogger) : base(validationLogger) { _runtimeConfiguration = runtimeConfiguration; diff --git a/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs index d45b8f01b..a1c70c5be 100644 --- a/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Authentication/AzureAuthenticationValidationStepTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Core; using Promitor.Agents.Scraper.Validation.Steps; using Xunit; @@ -25,7 +26,7 @@ public void ApplicationId_EmptyString_Fails() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -46,7 +47,7 @@ public void ApplicationId_Valid_Succeeds() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -67,7 +68,7 @@ public void ApplicationId_Whitespace_Fails() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -88,7 +89,7 @@ public void ApplicationKey_EmptyString_Fails() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -109,7 +110,7 @@ public void ApplicationKey_Whitespace_Fails() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -131,7 +132,7 @@ public void ApplicationKey_Valid_Succeeds() var config = CreateConfiguration(inMemoryConfiguration); // Act - var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config); + var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/GeneralMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/GeneralMetricsDeclarationValidationStepTests.cs index 82988de68..bf7ee270f 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/GeneralMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/GeneralMetricsDeclarationValidationStepTests.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using AutoMapper; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Core.Scraping.Configuration.Serialization.v1.Mapping; using Promitor.Core.Scraping.Configuration.Serialization.v1.Model; using Promitor.Agents.Scraper.Validation.Steps; @@ -32,7 +33,7 @@ public void MetricsDeclaration_DeclarationWithDuplicateMetricNames_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -48,7 +49,7 @@ public void MetricsDeclaration_DeclarationWithMetadataThatDoesNotHaveResourceGro var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -64,7 +65,7 @@ public void MetricsDeclaration_DeclarationWithMetadataThatDoesNotHaveSubscriptio var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -80,7 +81,7 @@ public void MetricsDeclaration_DeclarationWithMetadataThatDoesNotHaveTenantId_Fa var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -96,7 +97,7 @@ public void MetricsDeclaration_DeclarationWithoutMetadata_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -113,7 +114,7 @@ public void MetricsDeclaration_WithoutDefaultScrapingSchedule_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, _mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ApiManagementMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ApiManagementMetricsDeclarationValidationStepsTests.cs index e8a37587d..a461639d2 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ApiManagementMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ApiManagementMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutAzureMetricName_Fa var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -35,7 +36,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutLocationName_Succe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -52,7 +53,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutMetricDescription_ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -69,7 +70,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -86,7 +87,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutInstanceName_Fails var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -103,7 +104,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutResourceAndResourc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -120,7 +121,7 @@ public void ApiManagementMetricsDeclaration_DeclarationWithoutResourceButWithRes var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -137,7 +138,7 @@ public void ApiManagementMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/AppPlanMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/AppPlanMetricsDeclarationValidationStepsTests.cs index 0a370b001..31e6ad37a 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/AppPlanMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/AppPlanMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutMetricDescription_Succee var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutAppPlanName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutResourceAndResourceDisco var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void AppPlanMetricsDeclaration_DeclarationWithoutResourceButWithResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void AppPlanMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/BlobStorageMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/BlobStorageMetricsDeclarationValidationStepTests.cs index ef6f16f05..f8e35dbd6 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/BlobStorageMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/BlobStorageMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Integrations.AzureStorage; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; @@ -20,7 +21,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutAccountName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -37,7 +38,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutAzureMetricName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -54,7 +55,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutMetricDescription_Su var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -71,7 +72,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -89,7 +90,7 @@ public void BlobStorageMetricsDeclaration_ValidDeclarationWithAzureMetricNameInD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -106,7 +107,7 @@ public void BlobStorageMetricsDeclaration_ValidDeclarationWithMessageCount_Succe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -123,7 +124,7 @@ public void BlobStorageMetricsDeclaration_ValidDeclarationWithTimeSpentInQueue_S var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -140,7 +141,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutResourceAndResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -157,7 +158,7 @@ public void BlobStorageMetricsDeclaration_DeclarationWithoutResourceButWithResou var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerInstanceMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerInstanceMetricsDeclarationValidationStepTests.cs index 9624f5881..c9891dd97 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerInstanceMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerInstanceMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutAzureMetricNam var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutMetricDescript var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutMetricName_Fai var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutContainerGroup var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutResourceAndRes var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void ContainerInstanceMetricsDeclaration_DeclarationWithoutResourceButWit var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void ContainerInstanceMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerRegistryMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerRegistryMetricsDeclarationValidationStepTests.cs index 5258cc83f..1faa305f9 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerRegistryMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ContainerRegistryMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void ContainerRegistryMetricsDeclaration_DeclarationWithoutAzureMetricNam var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void ContainerRegistryMetricsDeclaration_DeclarationWithoutMetricDescript var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -55,7 +56,7 @@ public void var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -72,7 +73,7 @@ public void ContainerRegistryMetricsDeclaration_DeclarationWithoutRegistryName_F var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -89,7 +90,7 @@ public void ContainerRegistryMetricsDeclaration_DeclarationWithoutResourceAndRes var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -106,7 +107,7 @@ public void ContainerRegistryMetricsDeclaration_DeclarationWithoutResourceButWit var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -123,7 +124,7 @@ public void ContainerRegistryMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/CosmosDbMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/CosmosDbMetricsDeclarationValidationStepTests.cs index 80ea23643..9dc34a28a 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/CosmosDbMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/CosmosDbMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutMetricDescription_Succe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutDbName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutResourceAndResourceDisc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void CosmosDbMetricsDeclaration_DeclarationWithoutResourceButWithResource var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void CosmosDbMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/DeviceProvisioningServiceMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/DeviceProvisioningServiceMetricsDeclarationValidationStepsTests.cs index 8b1b55e2d..875e93453 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/DeviceProvisioningServiceMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/DeviceProvisioningServiceMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutAzureM var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutMetric var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutMetric var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutDevice var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_DeclarationWithoutResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void DeviceProvisioningServiceMetricsDeclaration_ValidDeclaration_Succeed var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FileStorageMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FileStorageMetricsDeclarationValidationStepTests.cs index 2125d1cee..bf2fac8f8 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FileStorageMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FileStorageMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Integrations.AzureStorage; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; @@ -20,7 +21,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutAccountName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -37,7 +38,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutAzureMetricName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -54,7 +55,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutMetricDescription_Su var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -71,7 +72,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -89,7 +90,7 @@ public void FileStorageMetricsDeclaration_ValidDeclarationWithAzureMetricNameInD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -106,7 +107,7 @@ public void FileStorageMetricsDeclaration_ValidDeclarationWithMessageCount_Succe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -123,7 +124,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutResourceAndResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -140,7 +141,7 @@ public void FileStorageMetricsDeclaration_DeclarationWithoutResourceButWithResou var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -157,7 +158,7 @@ public void FileStorageMetricsDeclaration_ValidDeclarationWithTimeSpentInQueue_S var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FunctionAppMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FunctionAppMetricsDeclarationValidationStepsTests.cs index fe1812662..d25a952db 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FunctionAppMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/FunctionAppMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutAzureMetricName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutMetricDescription_Su var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutFunctionAppName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutResourceAndResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void FunctionAppMetricsDeclaration_DeclarationWithoutResourceButWithResou var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void FunctionAppMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/GenericMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/GenericMetricsDeclarationValidationStepTests.cs index 101518082..987662f76 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/GenericMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/GenericMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutFilter_Succeeded() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void GenericMetricsDeclaration_DeclarationWithFilter_Succeeded() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutMetricDescription_Succee var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutResourceUri_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutResourceAndResourceDisco var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -138,7 +139,7 @@ public void GenericMetricsDeclaration_DeclarationWithoutResourceButWithResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -155,7 +156,7 @@ public void GenericMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/IoTHubMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/IoTHubMetricsDeclarationValidationStepsTests.cs index 49f9efd20..d6e65ce0b 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/IoTHubMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/IoTHubMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutMetricDescription_Succeed var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutIoTHubName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscov var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void IoTHubMetricsDeclaration_DeclarationWithoutResourceButWithResourceDi var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void IoTHubMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/KeyVaultMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/KeyVaultMetricsDeclarationValidationStepsTests.cs index 420108490..df2f02037 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/KeyVaultMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/KeyVaultMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutMetricDescription_Succe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutVaultName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutResourceAndResourceDisc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void KeyVaultMetricsDeclaration_DeclarationWithoutResourceButWithResource var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void KeyVaultMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/NetworkInterfaceMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/NetworkInterfaceMetricsDeclarationValidationStepsTests.cs index 2336a3665..bc66ea02d 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/NetworkInterfaceMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/NetworkInterfaceMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutAzureMetricName var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutMetricDescripti var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutMetricName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutNetworkInterfac var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutResourceAndReso var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void NetworkInterfaceMetricsDeclaration_DeclarationWithoutResourceButWith var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void NetworkInterfaceMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/PostgreSqlMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/PostgreSqlMetricsDeclarationValidationStepTests.cs index 06facf553..969eda67b 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/PostgreSqlMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/PostgreSqlMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void PostgreSqlMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void PostgreSqlMetricsDeclaration_DeclarationWithoutAzureMetricDescriptio var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void PostgreSqlMetricsDeclaration_DeclarationWithoutServerName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void PostgreSqlMetricsDeclaration_DeclarationWithoutResourceAndResourceDi var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void PostgreSqlMetricsDeclaration_DeclarationWithoutResourceButWithResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void PostgreSqlMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/RedisCacheMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/RedisCacheMetricsDeclarationValidationStepTests.cs index 18bfbb1c2..fb85c70d1 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/RedisCacheMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/RedisCacheMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void RedisCacheMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void RedisCacheMetricsDeclaration_DeclarationWithoutAzureMetricDescriptio var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void RedisCacheMetricsDeclaration_DeclarationWithoutCacheName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void RedisCacheMetricsDeclaration_DeclarationWithoutResourceAndResourceDi var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void RedisCacheMetricsDeclaration_DeclarationWithoutResourceButWithResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void RedisCacheMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ServiceBusQueueMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ServiceBusQueueMetricsDeclarationValidationStepTests.cs index 3b88bdbea..09690969a 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ServiceBusQueueMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/ServiceBusQueueMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutAzureMetricName var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void ServiceBusQueuesMetricsDeclaration_UseEntityNameAsDimension_Blocked( var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void ServiceBusQueuesMetricsDeclaration_UseAllowedDimension_Succeeded() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutResourceAndReso var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutResourceButWith var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutMetricDescripti var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -123,7 +124,7 @@ public void var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -140,7 +141,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutQueueName_Fails var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -157,7 +158,7 @@ public void ServiceBusQueuesMetricsDeclaration_DeclarationWithoutServiceBusNames var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -174,7 +175,7 @@ public void ServiceBusQueuesMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlDatabaseMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlDatabaseMetricsDeclarationValidationStepTests.cs index a34b0a681..72b0d58f4 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlDatabaseMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlDatabaseMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutAzureMetricName_Fail var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutAzureMetricDescripti var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutServerName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutDatabaseName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutResourceAndResourceD var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void SqlDatabaseMetricsDeclaration_DeclarationWithoutResourceButWithResou var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void SqlDatabaseMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlManagedInstanceMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlManagedInstanceMetricsDeclarationValidationStepTests.cs index 34a02e336..46ca88252 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlManagedInstanceMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlManagedInstanceMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void SqlManagedInstanceMetricsDeclaration_DeclarationWithoutAzureMetricNa var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void SqlManagedInstanceMetricsDeclaration_DeclarationWithoutAzureMetricDe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void SqlManagedInstanceMetricsDeclaration_DeclarationWithoutInstanceName_ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void SqlManagedInstanceMetricsDeclaration_DeclarationWithoutResourceAndRe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void SqlManagedInstanceMetricsDeclaration_DeclarationWithoutResourceButWi var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void SqlManagedInstanceMetricsDeclaration_ValidDeclaration_Succeed() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlServerMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlServerMetricsDeclarationValidationStepTests.cs index 283c147bb..85abcc9dc 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlServerMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/SqlServerMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void SqlServerMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails( var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void SqlServerMetricsDeclaration_DeclarationWithoutAzureMetricDescription var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void SqlServerMetricsDeclaration_DeclarationWithoutServerName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void SqlServerMetricsDeclaration_DeclarationWithoutResourceAndResourceDis var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void SqlServerMetricsDeclaration_DeclarationWithoutResourceButWithResourc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void SqlServerMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageAccountMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageAccountMetricsDeclarationValidationStepTests.cs index 58b7f413b..ba50f2b1d 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageAccountMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageAccountMetricsDeclarationValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Integrations.AzureStorage; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; @@ -20,7 +21,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutAccountName_Fails var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -37,7 +38,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutAzureMetricName_F var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -54,7 +55,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutMetricDescription var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -71,7 +72,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutMetricName_Fails( var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -89,7 +90,7 @@ public void StorageAccountMetricsDeclaration_ValidDeclarationWithAzureMetricName var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -106,7 +107,7 @@ public void StorageAccountMetricsDeclaration_ValidDeclarationWithMessageCount_Su var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -123,7 +124,7 @@ public void StorageAccountMetricsDeclaration_ValidDeclarationWithTimeSpentInQueu var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -140,7 +141,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutResourceAndResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -157,7 +158,7 @@ public void StorageAccountMetricsDeclaration_DeclarationWithoutResourceButWithRe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageQueueMetricsDeclarationValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageQueueMetricsDeclarationValidationStepTests.cs index 0ddc362e0..2f693b38d 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageQueueMetricsDeclarationValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/StorageQueueMetricsDeclarationValidationStepTests.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Integrations.AzureStorage; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; @@ -22,7 +23,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithNotSupportedMetricNam var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -39,7 +40,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutAccountName_Fails( var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -56,7 +57,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutAzureMetricName_Fa var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -73,7 +74,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutMetricDescription_ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -90,7 +91,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -107,7 +108,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutQueueName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -124,7 +125,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutSasToken_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -142,7 +143,7 @@ public void StorageQueuesMetricsDeclaration_ValidDeclarationWithAzureMetricNameI var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -159,7 +160,7 @@ public void StorageQueuesMetricsDeclaration_ValidDeclarationWithMessageCount_Suc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -176,7 +177,7 @@ public void StorageQueuesMetricsDeclaration_ValidDeclarationWithTimeSpentInQueue var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -193,7 +194,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutResourceAndResourc var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -210,7 +211,7 @@ public void StorageQueuesMetricsDeclaration_DeclarationWithoutResourceButWithRes var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineMetricsDeclarationValidationStepsTests.cs index 0b05643e1..7950ce713 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutAzureMetricName_F var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutMetricDescription var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutMetricName_Fails( var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutVirtualMachineNam var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutResourceAndResour var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void VirtualMachineMetricsDeclaration_DeclarationWithoutResourceButWithRe var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void VirtualMachineMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineScaleSetMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineScaleSetMetricsDeclarationValidationStepsTests.cs index d754b631c..b7bbee689 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineScaleSetMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/VirtualMachineScaleSetMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutAzureMetr var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutMetricDes var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutMetricNam var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutVirtualMa var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutResourceA var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_DeclarationWithoutResourceB var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void VirtualMachineScaleSetMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/WebAppMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/WebAppMetricsDeclarationValidationStepsTests.cs index 2f76a63a3..a873965b4 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/WebAppMetricsDeclarationValidationStepsTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/ResourceTypes/WebAppMetricsDeclarationValidationStepsTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Tests.Unit.Builders.Metrics.v1; using Promitor.Tests.Unit.Stubs; @@ -19,7 +20,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -36,7 +37,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutMetricDescription_Succeed var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -53,7 +54,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutMetricName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -70,7 +71,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutWebAppName_Fails() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -87,7 +88,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutSlotName_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -104,7 +105,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscov var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -121,7 +122,7 @@ public void WebAppMetricsDeclaration_DeclarationWithoutResourceButWithResourceDi var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -138,7 +139,7 @@ public void WebAppMetricsDeclaration_ValidDeclaration_Succeeds() var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper); // Act - var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider); + var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/PrometheusScrapingEndpointMetricSinkValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/PrometheusScrapingEndpointMetricSinkValidationStepTests.cs index 392b51038..1dced2593 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/PrometheusScrapingEndpointMetricSinkValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/PrometheusScrapingEndpointMetricSinkValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Promitor.Agents.Scraper.Configuration; using Promitor.Agents.Scraper.Validation.Steps.Sinks; @@ -17,7 +18,7 @@ public void Validate_PrometheusScrapingEndpointIsFullyConfigured_Success() var runtimeConfiguration = CreateRuntimeConfiguration(); // Act - var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration); + var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = prometheusScrapingEndpointMetricSinkValidationStep.Run(); // Assert @@ -32,7 +33,7 @@ public void Validate_PrometheusScrapingEndpointIsNotConfigured_Success() runtimeConfiguration.Value.MetricSinks.PrometheusScrapingEndpoint = null; // Act - var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration); + var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = prometheusScrapingEndpointMetricSinkValidationStep.Run(); // Assert @@ -46,7 +47,7 @@ public void Validate_NoSinksConfigured_Success() runtimeConfiguration.Value.MetricSinks = null; // Act - var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration); + var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = prometheusScrapingEndpointMetricSinkValidationStep.Run(); // Assert @@ -61,7 +62,7 @@ public void Validate_PrometheusScrapingEndpointWithoutBaseUriPath_Fails() runtimeConfiguration.Value.MetricSinks.PrometheusScrapingEndpoint.BaseUriPath = string.Empty; // Act - var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration); + var prometheusScrapingEndpointMetricSinkValidationStep = new PrometheusScrapingEndpointMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = prometheusScrapingEndpointMetricSinkValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/StatsDMetricSinkValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/StatsDMetricSinkValidationStepTests.cs index 4f79b0219..62acce7f9 100644 --- a/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/StatsDMetricSinkValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Metrics/Sinks/StatsDMetricSinkValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Promitor.Agents.Scraper.Configuration; using Promitor.Agents.Scraper.Validation.Steps.Sinks; @@ -17,7 +18,7 @@ public void Validate_StatsDIsFullyConfigured_Success() var runtimeConfiguration = CreateRuntimeConfiguration(); // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -32,7 +33,7 @@ public void Validate_StatsDIsNotConfigured_Success() runtimeConfiguration.Value.MetricSinks.Statsd = null; // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -46,7 +47,7 @@ public void Validate_NoSinksConfigured_Success() runtimeConfiguration.Value.MetricSinks = null; // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -61,7 +62,7 @@ public void Validate_StatsDWithNegativePort_Fails() runtimeConfiguration.Value.MetricSinks.Statsd.Port = -1; // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -79,7 +80,7 @@ public void Validate_StatsDWithoutHost_Fails(string host) runtimeConfiguration.Value.MetricSinks.Statsd.Host = host; // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -96,7 +97,7 @@ public void Validate_StatsDWithoutMetricPrefix_Succeeds(string metricPrefix) runtimeConfiguration.Value.MetricSinks.Statsd.MetricPrefix = metricPrefix; // Act - var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration); + var azureAuthenticationValidationStep = new StatsDMetricSinkValidationStep(runtimeConfiguration, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Misc/ConfigurationPathValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Misc/ConfigurationPathValidationStepTests.cs index 8ff93b7b4..9f49a2d86 100644 --- a/src/Promitor.Tests.Unit/Validation/Misc/ConfigurationPathValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Misc/ConfigurationPathValidationStepTests.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Core.Scraping.Configuration.Runtime; @@ -15,8 +16,9 @@ public void ConfigurationPath_FileDoesNotExist_Fails() // Arrange const string validConfigurationPath = "Invalid"; var configOptions = Options.Create(new MetricsConfiguration {AbsolutePath = validConfigurationPath}); + // Act - var scrapingScheduleValidationStep = new ConfigurationPathValidationStep(configOptions); + var scrapingScheduleValidationStep = new ConfigurationPathValidationStep(configOptions, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert @@ -31,7 +33,7 @@ public void ConfigurationPath_FileExists_Succeeds() var configOptions = Options.Create(new MetricsConfiguration {AbsolutePath = invalidConfigurationPath}); // Act - var scrapingScheduleValidationStep = new ConfigurationPathValidationStep(configOptions); + var scrapingScheduleValidationStep = new ConfigurationPathValidationStep(configOptions, NullLogger.Instance); var validationResult = scrapingScheduleValidationStep.Run(); // Assert diff --git a/src/Promitor.Tests.Unit/Validation/Misc/ResourceDiscoveryValidationStepTests.cs b/src/Promitor.Tests.Unit/Validation/Misc/ResourceDiscoveryValidationStepTests.cs index 0a457d5f9..33c6ce74e 100644 --- a/src/Promitor.Tests.Unit/Validation/Misc/ResourceDiscoveryValidationStepTests.cs +++ b/src/Promitor.Tests.Unit/Validation/Misc/ResourceDiscoveryValidationStepTests.cs @@ -1,5 +1,7 @@ using System.ComponentModel; using AutoMapper; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; using Promitor.Agents.Scraper.Configuration; using Promitor.Agents.Scraper.Validation.Steps; using Promitor.Core.Scraping.Configuration.Serialization.v1.Mapping; @@ -29,7 +31,7 @@ public void Validate_ResourceDiscoveryIsFullyConfigured_Success() var resourceDiscoveryConfiguration = CreateRuntimeConfiguration(); // Act - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -41,11 +43,11 @@ public void Validate_ResourceDiscoveryIsNotConfigured_Success() { // Arrange var metricsDeclarationProvider = GetMetricDeclarationProvider(); - ResourceDiscoveryConfiguration resourceDiscoveryConfiguration = null; + IOptions resourceDiscoveryConfiguration = null; // Act // ReSharper disable once ExpressionIsAlwaysNull - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -57,11 +59,11 @@ public void Validate_ResourceDiscoveryIsNotConfiguredButMetricWithDiscoveryIsDef { // Arrange var metricsDeclarationProvider = GetMetricDeclarationProvider(useDiscoveryGroup: true); - ResourceDiscoveryConfiguration resourceDiscoveryConfiguration = null; + IOptions resourceDiscoveryConfiguration = null; // Act // ReSharper disable once ExpressionIsAlwaysNull - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -74,10 +76,10 @@ public void Validate_StatsDWithNegativePort_Fails() // Arrange var metricsDeclarationProvider = GetMetricDeclarationProvider(); var resourceDiscoveryConfiguration = CreateRuntimeConfiguration(); - resourceDiscoveryConfiguration.Port = -1; + resourceDiscoveryConfiguration.Value.Port = -1; // Act - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -90,10 +92,10 @@ public void Validate_StatsDWithPortZero_Fails() // Arrange var metricsDeclarationProvider = GetMetricDeclarationProvider(); var resourceDiscoveryConfiguration = CreateRuntimeConfiguration(); - resourceDiscoveryConfiguration.Port = 0; + resourceDiscoveryConfiguration.Value.Port = 0; // Act - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert @@ -109,21 +111,21 @@ public void Validate_NoHostIsConfigured_Fails(string host) // Arrange var metricsDeclarationProvider = GetMetricDeclarationProvider(); var resourceDiscoveryConfiguration = CreateRuntimeConfiguration(); - resourceDiscoveryConfiguration.Host = host; + resourceDiscoveryConfiguration.Value.Host = host; // Act - var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider); + var azureAuthenticationValidationStep = new ResourceDiscoveryValidationStep(resourceDiscoveryConfiguration, metricsDeclarationProvider, NullLogger.Instance); var validationResult = azureAuthenticationValidationStep.Run(); // Assert Assert.False(validationResult.IsSuccessful); } - private ResourceDiscoveryConfiguration CreateRuntimeConfiguration() + private IOptions CreateRuntimeConfiguration() { var bogusRuntimeConfiguration = BogusScraperRuntimeConfigurationGenerator.Generate(); - return bogusRuntimeConfiguration.ResourceDiscovery; + return Options.Create(bogusRuntimeConfiguration.ResourceDiscovery); } private MetricsDeclarationProviderStub GetMetricDeclarationProvider(bool useDiscoveryGroup=false)