@@ -25,30 +25,30 @@ public class MauiPlatformExtensionsTests
2525 ( maui , name ) => maui . AddWindowsDevice ( name ) ,
2626 typeof ( MauiWindowsPlatformResource ) ) ,
2727
28- new PlatformTestConfig ( "MacCatalyst" , "Mac Catalyst" , "maccatalyst" , "mauiapp-maccatalyst" , "net10.0-maccatalyst" ,
29- ( maui ) => maui . AddMacCatalystDevice ( ) ,
30- ( maui , name ) => maui . AddMacCatalystDevice ( name ) ,
31- typeof ( MauiMacCatalystPlatformResource ) ) ,
28+ // new PlatformTestConfig("MacCatalyst", "Mac Catalyst", "maccatalyst", "mauiapp-maccatalyst", "net10.0-maccatalyst",
29+ // (maui) => maui.AddMacCatalystDevice(),
30+ // (maui, name) => maui.AddMacCatalystDevice(name),
31+ // typeof(MauiMacCatalystPlatformResource)),
3232
33- new PlatformTestConfig ( "AndroidDevice" , "Android" , "android" , "mauiapp-android-device" , "net10.0-android" ,
34- ( maui ) => maui . AddAndroidDevice ( ) ,
35- ( maui , name ) => maui . AddAndroidDevice ( name ) ,
36- typeof ( MauiAndroidDeviceResource ) ) ,
33+ // new PlatformTestConfig("AndroidDevice", "Android", "android", "mauiapp-android-device", "net10.0-android",
34+ // (maui) => maui.AddAndroidDevice(),
35+ // (maui, name) => maui.AddAndroidDevice(name),
36+ // typeof(MauiAndroidDeviceResource)),
3737
38- new PlatformTestConfig ( "AndroidEmulator" , "Android" , "android" , "mauiapp-android-emulator" , "net10.0-android" ,
39- ( maui ) => maui . AddAndroidEmulator ( ) ,
40- ( maui , name ) => maui . AddAndroidEmulator ( name ) ,
41- typeof ( MauiAndroidEmulatorResource ) ) ,
38+ // new PlatformTestConfig("AndroidEmulator", "Android", "android", "mauiapp-android-emulator", "net10.0-android",
39+ // (maui) => maui.AddAndroidEmulator(),
40+ // (maui, name) => maui.AddAndroidEmulator(name),
41+ // typeof(MauiAndroidEmulatorResource)),
4242
43- new PlatformTestConfig ( "iOSDevice" , "iOS" , "ios" , "mauiapp-ios-device" , "net10.0-ios" ,
44- ( maui ) => maui . AddiOSDevice ( ) ,
45- ( maui , name ) => maui . AddiOSDevice ( name ) ,
46- typeof ( MauiiOSDeviceResource ) ) ,
43+ // new PlatformTestConfig("iOSDevice", "iOS", "ios", "mauiapp-ios-device", "net10.0-ios",
44+ // (maui) => maui.AddiOSDevice(),
45+ // (maui, name) => maui.AddiOSDevice(name),
46+ // typeof(MauiiOSDeviceResource)),
4747
48- new PlatformTestConfig ( "iOSSimulator" , "iOS" , "ios" , "mauiapp-ios-simulator" , "net10.0-ios" ,
49- ( maui ) => maui . AddiOSSimulator ( ) ,
50- ( maui , name ) => maui . AddiOSSimulator ( name ) ,
51- typeof ( MauiiOSSimulatorResource ) )
48+ // new PlatformTestConfig("iOSSimulator", "iOS", "ios", "mauiapp-ios-simulator", "net10.0-ios",
49+ // (maui) => maui.AddiOSSimulator(),
50+ // (maui, name) => maui.AddiOSSimulator(name),
51+ // typeof(MauiiOSSimulatorResource))
5252 } ;
5353
5454 [ Theory ]
@@ -615,6 +615,47 @@ public void WithOtlpDevTunnel_MultiplePlatforms_SharesSameInfrastructure(Platfor
615615 }
616616 }
617617
618+ [ Theory ]
619+ [ MemberData ( nameof ( AllPlatforms ) ) ]
620+ public async Task WithOtlpDevTunnel_CleansUpIntermediateEnvironmentVariables ( PlatformTestConfig config )
621+ {
622+ // Arrange
623+ var projectContent = CreateProjectContent ( config . RequiredTfm ) ;
624+ var tempFile = CreateTempProjectFile ( projectContent ) ;
625+
626+ try
627+ {
628+ var appBuilder = DistributedApplication . CreateBuilder ( ) ;
629+ var maui = appBuilder . AddMauiProject ( "mauiapp" , tempFile ) ;
630+ var platform = config . AddPlatformWithDefaultName ( maui ) ;
631+
632+ // Act
633+ config . ApplyWithOtlpDevTunnel ( platform ) ;
634+
635+ var envVars = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync (
636+ platform . Resource ,
637+ DistributedApplicationOperation . Run ,
638+ TestServiceProvider . Instance ) ;
639+
640+ // Assert
641+ Assert . True ( envVars . TryGetValue ( "OTEL_EXPORTER_OTLP_ENDPOINT" , out var endpointValue ) ) ;
642+ Assert . False ( string . IsNullOrWhiteSpace ( endpointValue ) ) ;
643+ Assert . True ( Uri . TryCreate ( endpointValue , UriKind . Absolute , out _ ) ) ;
644+
645+ var tunnelConfig = maui . Resource . Annotations . OfType < OtlpDevTunnelConfigurationAnnotation > ( ) . Single ( ) ;
646+ var stubName = tunnelConfig . OtlpStub . Name ;
647+ var serviceDiscoveryKey = $ "services__{ stubName } __otlp__0";
648+ Assert . DoesNotContain ( serviceDiscoveryKey , envVars . Keys ) ;
649+
650+ var directEndpointKey = $ "{ EnvironmentVariableNameEncoder . Encode ( stubName ) . ToUpperInvariant ( ) } _OTLP";
651+ Assert . DoesNotContain ( directEndpointKey , envVars . Keys ) ;
652+ }
653+ finally
654+ {
655+ CleanupTempFile ( tempFile ) ;
656+ }
657+ }
658+
618659 // Helper methods
619660
620661 private static string CreateProjectContent ( string requiredTfm )
0 commit comments