public async Task RuntimeConfiguration_IsFullyConfigured_UsesCorrectValues() { // Arrange var bogusRuntimeConfiguration = BogusRuntimeConfigurationGenerator.Generate(); var configuration = await RuntimeConfigurationGenerator.WithRuntimeConfiguration(bogusRuntimeConfiguration) .GenerateAsync(); // Act var runtimeConfiguration = configuration.Get <RuntimeConfiguration>(); // Assert Assert.NotNull(runtimeConfiguration); Assert.NotNull(runtimeConfiguration.Server); Assert.NotNull(runtimeConfiguration.Telemetry); Assert.NotNull(runtimeConfiguration.Telemetry.ApplicationInsights); Assert.NotNull(runtimeConfiguration.Telemetry.ContainerLogs); Assert.NotNull(runtimeConfiguration.Prometheus); Assert.NotNull(runtimeConfiguration.Prometheus.ScrapeEndpoint); Assert.NotNull(runtimeConfiguration.MetricsConfiguration); Assert.Equal(bogusRuntimeConfiguration.Server.HttpPort, runtimeConfiguration.Server.HttpPort); Assert.Equal(bogusRuntimeConfiguration.Telemetry.DefaultVerbosity, runtimeConfiguration.Telemetry.DefaultVerbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.Verbosity, runtimeConfiguration.Telemetry.ApplicationInsights.Verbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.InstrumentationKey, runtimeConfiguration.Telemetry.ApplicationInsights.InstrumentationKey); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.IsEnabled, runtimeConfiguration.Telemetry.ApplicationInsights.IsEnabled); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ContainerLogs.Verbosity, runtimeConfiguration.Telemetry.ContainerLogs.Verbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ContainerLogs.IsEnabled, runtimeConfiguration.Telemetry.ContainerLogs.IsEnabled); Assert.Equal(bogusRuntimeConfiguration.Prometheus.EnableMetricTimestamps, runtimeConfiguration.Prometheus.EnableMetricTimestamps); Assert.Equal(bogusRuntimeConfiguration.Prometheus.MetricUnavailableValue, runtimeConfiguration.Prometheus.MetricUnavailableValue); Assert.Equal(bogusRuntimeConfiguration.Prometheus.ScrapeEndpoint.BaseUriPath, runtimeConfiguration.Prometheus.ScrapeEndpoint.BaseUriPath); Assert.Equal(bogusRuntimeConfiguration.MetricsConfiguration.AbsolutePath, runtimeConfiguration.MetricsConfiguration.AbsolutePath); }
public async Task RuntimeConfiguration_IsFullyConfigured_UsesCorrectValues() { // Arrange var bogusRuntimeConfiguration = BogusScraperRuntimeConfigurationGenerator.Generate(); var configuration = await RuntimeConfigurationGenerator.WithRuntimeConfiguration(bogusRuntimeConfiguration) .GenerateAsync(); // Act var runtimeConfiguration = configuration.Get <ScraperRuntimeConfiguration>(); // Assert Assert.NotNull(runtimeConfiguration); Assert.NotNull(runtimeConfiguration.Server); Assert.NotNull(runtimeConfiguration.MetricSinks); Assert.NotNull(runtimeConfiguration.MetricSinks.Statsd); Assert.NotNull(runtimeConfiguration.Telemetry); Assert.NotNull(runtimeConfiguration.Telemetry.ApplicationInsights); Assert.NotNull(runtimeConfiguration.Telemetry.ContainerLogs); Assert.NotNull(runtimeConfiguration.MetricsConfiguration); Assert.NotNull(runtimeConfiguration.ResourceDiscovery); Assert.Equal(bogusRuntimeConfiguration.Server.HttpPort, runtimeConfiguration.Server.HttpPort); Assert.Equal(bogusRuntimeConfiguration.Server.MaxDegreeOfParallelism, runtimeConfiguration.Server.MaxDegreeOfParallelism); Assert.Equal(bogusRuntimeConfiguration.ResourceDiscovery.Host, runtimeConfiguration.ResourceDiscovery.Host); Assert.Equal(bogusRuntimeConfiguration.ResourceDiscovery.Port, runtimeConfiguration.ResourceDiscovery.Port); Assert.Equal(bogusRuntimeConfiguration.Telemetry.DefaultVerbosity, runtimeConfiguration.Telemetry.DefaultVerbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.Verbosity, runtimeConfiguration.Telemetry.ApplicationInsights.Verbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.InstrumentationKey, runtimeConfiguration.Telemetry.ApplicationInsights.InstrumentationKey); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ApplicationInsights.IsEnabled, runtimeConfiguration.Telemetry.ApplicationInsights.IsEnabled); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ContainerLogs.Verbosity, runtimeConfiguration.Telemetry.ContainerLogs.Verbosity); Assert.Equal(bogusRuntimeConfiguration.Telemetry.ContainerLogs.IsEnabled, runtimeConfiguration.Telemetry.ContainerLogs.IsEnabled); Assert.Equal(bogusRuntimeConfiguration.MetricsConfiguration.AbsolutePath, runtimeConfiguration.MetricsConfiguration.AbsolutePath); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.BaseUriPath, runtimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.BaseUriPath); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.EnableMetricTimestamps, runtimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.EnableMetricTimestamps); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.MetricUnavailableValue, runtimeConfiguration.MetricSinks.PrometheusScrapingEndpoint.MetricUnavailableValue); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.Statsd.Host, runtimeConfiguration.MetricSinks.Statsd.Host); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.Statsd.Port, runtimeConfiguration.MetricSinks.Statsd.Port); Assert.Equal(bogusRuntimeConfiguration.MetricSinks.Statsd.MetricPrefix, runtimeConfiguration.MetricSinks.Statsd.MetricPrefix); }