Skip to content

Commit b6b0a6a

Browse files
Copilotaaronpowell
andcommitted
Add OtlpExporterAnnotation assertion to test as requested
Co-authored-by: aaronpowell <[email protected]>
1 parent 7682748 commit b6b0a6a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/CommunityToolkit.Aspire.Hosting.GoFeatureFlag.Tests/AddGoFeatureFlagTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,15 @@ public void AddGoFeatureFlagAddsOtelAnnotation()
121121
var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
122122
var resource = Assert.Single(appModel.Resources.OfType<GoFeatureFlagResource>());
123123

124-
// Verify that OTEL environment callback annotation is present (added by WithOtlpExporter)
124+
// Verify that OtlpExporterAnnotation is present (added by WithOtlpExporter)
125+
// This annotation marks the resource as an OTEL exporter
126+
Assert.True(resource.HasAnnotationOfType<OtlpExporterAnnotation>());
127+
128+
// Verify that environment callback annotation is present for OTEL configuration
129+
// The callback will set environment variables like:
130+
// - OTEL_EXPORTER_OTLP_ENDPOINT
131+
// - OTEL_EXPORTER_OTLP_PROTOCOL
132+
// - OTEL_SERVICE_NAME
125133
var envAnnotations = resource.Annotations.OfType<EnvironmentCallbackAnnotation>().ToArray();
126134
Assert.NotEmpty(envAnnotations);
127135
}

0 commit comments

Comments
 (0)