From c6e1053962703c2bcacff3373f52595edb62d0ef Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Tue, 6 Aug 2024 13:48:45 +0800 Subject: [PATCH] Config test --- .../Integration/StartupTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Aspire.Dashboard.Tests/Integration/StartupTests.cs b/tests/Aspire.Dashboard.Tests/Integration/StartupTests.cs index 1ee6bd88d24..aafe264113d 100644 --- a/tests/Aspire.Dashboard.Tests/Integration/StartupTests.cs +++ b/tests/Aspire.Dashboard.Tests/Integration/StartupTests.cs @@ -436,6 +436,22 @@ public async Task EndPointAccessors_AppStarted_BrowserGet_Success() Assert.NotEmpty(response.Headers.GetValues(HeaderNames.ContentSecurityPolicy).Single()); } + [Fact] + public async Task Configuration_CorsNoOtlpHttpEndpoint_Error() + { + // Arrange & Act + await using var app = IntegrationTestHelpers.CreateDashboardWebApplication(testOutputHelper, + additionalConfiguration: data => + { + data.Remove(DashboardConfigNames.DashboardOtlpHttpUrlName.ConfigKey); + data[$"{DashboardConfigNames.DashboardOtlpCorsAllowedOriginsKeyName.ConfigKey}:0"] = "https://localhost:666"; + }); + + // Assert + Assert.Collection(app.ValidationFailures, + s => Assert.Contains(DashboardConfigNames.DashboardOtlpHttpUrlName.ConfigKey, s)); + } + private static void AssertDynamicIPEndpoint(Func endPointAccessor) { // Check that the specified dynamic port of 0 is overridden with the actual port number.