Skip to content

Commit 95e2a96

Browse files
authored
Merge pull request #445 from devstress/copilot/remove-previous-learning-properties
Remove environment variable state restoration from test teardown
2 parents 166a838 + 81f64a7 commit 95e2a96

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,4 @@ test-results*/
145145
# Release testing artifacts - built packages and docker images
146146
packages/
147147
docker/
148+
nul

LocalTesting/LocalTesting.IntegrationTests/GlobalTestInfrastructure.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class GlobalTestInfrastructure
1818
{
1919

2020
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(60);
21-
private static string? _previousLearningCourseMode;
22-
private static string? _previousIsTestingMode;
2321

2422
public static DistributedApplication? AppHost
2523
{
@@ -55,14 +53,6 @@ public async Task GlobalSetUp()
5553

5654
try
5755
{
58-
// Save previous environment variable values for restoration
59-
_previousLearningCourseMode = Environment.GetEnvironmentVariable("LEARNINGCOURSE");
60-
_previousIsTestingMode = Environment.GetEnvironmentVariable("IS_TESTING");
61-
62-
if (string.Equals(_previousLearningCourseMode, "true", StringComparison.OrdinalIgnoreCase))
63-
{
64-
Console.WriteLine("⚠️ LEARNINGCOURSE=true detected - forcing Aspire integration-test profile.");
65-
}
6656
Environment.SetEnvironmentVariable("LEARNINGCOURSE", "false");
6757

6858
// Set IS_TESTING environment variable to indicate testing mode
@@ -265,10 +255,10 @@ public async Task GlobalTearDown()
265255
}
266256
}
267257

268-
// Restore previous environment variable values
269-
Environment.SetEnvironmentVariable("LEARNINGCOURSE", _previousLearningCourseMode);
270-
Environment.SetEnvironmentVariable("IS_TESTING", _previousIsTestingMode);
271-
Console.WriteLine("✅ Environment variables restored");
258+
// Remove environment variables
259+
Environment.SetEnvironmentVariable("LEARNINGCOURSE", null);
260+
Environment.SetEnvironmentVariable("IS_TESTING", null);
261+
Console.WriteLine("✅ Environment variables removed");
272262
}
273263

274264
/// <summary>

ObservabilityTesting/ObservabilityTesting.IntegrationTests/GlobalTestInfrastructure.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class GlobalTestInfrastructure
1717
{
1818

1919
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(60); // Balanced timeout: enough for TaskManager registration, faster failure detection
20-
private static string? _previousLearningCourseMode;
2120

2221
public static DistributedApplication? AppHost
2322
{
@@ -50,7 +49,6 @@ public async Task GlobalSetUp()
5049

5150
try
5251
{
53-
_previousLearningCourseMode = Environment.GetEnvironmentVariable("LEARNINGCOURSE");
5452
// ObservabilityTesting ALWAYS runs in LEARNINGCOURSE mode (Prometheus/Grafana stack required)
5553
// No environment variable check needed - we force it to true
5654
Console.WriteLine("✅ Setting LEARNINGCOURSE=true for ObservabilityTesting (always enabled)");
@@ -263,7 +261,8 @@ public async Task GlobalTearDown()
263261
}
264262
}
265263

266-
Environment.SetEnvironmentVariable("LEARNINGCOURSE", _previousLearningCourseMode);
264+
// Remove environment variable
265+
Environment.SetEnvironmentVariable("LEARNINGCOURSE", null);
267266
}
268267

269268
/// <summary>

0 commit comments

Comments
 (0)