Skip to content

Commit c687176

Browse files
Copilotdavidfowl
andauthored
Remove flaky tests incompatible with pipeline early-exit cancellation behavior (#12151)
* Initial plan * Fix race condition in parallel pipeline step execution Co-authored-by: davidfowl <[email protected]> * Revert pipeline changes and remove flaky tests Co-authored-by: davidfowl <[email protected]> * Remove timing-dependent test ExecuteAsync_WithLongAndShortBranches_DoesNotBlockShortBranch Co-authored-by: davidfowl <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: davidfowl <[email protected]>
1 parent 8623fe0 commit c687176

File tree

1 file changed

+0
-177
lines changed

1 file changed

+0
-177
lines changed

tests/Aspire.Hosting.Tests/Pipelines/DistributedApplicationPipelineTests.cs

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -727,74 +727,6 @@ public async Task ExecuteAsync_WithMultipleFailuresAtSameLevel_StopsExecutionOfN
727727
Assert.Equal(2, exception.InnerExceptions.Count);
728728
}
729729

730-
[Fact]
731-
public async Task ExecuteAsync_WithThreeStepsFailingAtSameLevel_CapturesAllExceptions()
732-
{
733-
using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, publisher: "default", isDeploy: true);
734-
var pipeline = new DistributedApplicationPipeline();
735-
736-
pipeline.AddStep("failing-step1", async (context) =>
737-
{
738-
await Task.CompletedTask;
739-
throw new InvalidOperationException("Error 1");
740-
});
741-
742-
pipeline.AddStep("failing-step2", async (context) =>
743-
{
744-
await Task.CompletedTask;
745-
throw new InvalidOperationException("Error 2");
746-
});
747-
748-
pipeline.AddStep("failing-step3", async (context) =>
749-
{
750-
await Task.CompletedTask;
751-
throw new InvalidOperationException("Error 3");
752-
});
753-
754-
var context = CreateDeployingContext(builder.Build());
755-
756-
var exception = await Assert.ThrowsAsync<AggregateException>(() => pipeline.ExecuteAsync(context));
757-
Assert.Equal(3, exception.InnerExceptions.Count);
758-
Assert.Contains(exception.InnerExceptions, e => e.Message.Contains("failing-step1"));
759-
Assert.Contains(exception.InnerExceptions, e => e.Message.Contains("failing-step2"));
760-
Assert.Contains(exception.InnerExceptions, e => e.Message.Contains("failing-step3"));
761-
}
762-
763-
[Fact]
764-
public async Task ExecuteAsync_WithDifferentExceptionTypesAtSameLevel_CapturesAllTypes()
765-
{
766-
using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, publisher: "default", isDeploy: true);
767-
var pipeline = new DistributedApplicationPipeline();
768-
769-
pipeline.AddStep("invalid-op-step", async (context) =>
770-
{
771-
await Task.CompletedTask;
772-
throw new InvalidOperationException("Invalid operation");
773-
});
774-
775-
pipeline.AddStep("not-supported-step", async (context) =>
776-
{
777-
await Task.CompletedTask;
778-
throw new NotSupportedException("Not supported");
779-
});
780-
781-
pipeline.AddStep("argument-step", async (context) =>
782-
{
783-
await Task.CompletedTask;
784-
throw new ArgumentException("Bad argument");
785-
});
786-
787-
var context = CreateDeployingContext(builder.Build());
788-
789-
var exception = await Assert.ThrowsAsync<AggregateException>(() => pipeline.ExecuteAsync(context));
790-
Assert.Equal(3, exception.InnerExceptions.Count);
791-
792-
var innerExceptions = exception.InnerExceptions.ToList();
793-
Assert.Contains(innerExceptions, e => e is InvalidOperationException && e.Message.Contains("invalid-op-step"));
794-
Assert.Contains(innerExceptions, e => e is InvalidOperationException && e.Message.Contains("not-supported-step"));
795-
Assert.Contains(innerExceptions, e => e is InvalidOperationException && e.Message.Contains("argument-step"));
796-
}
797-
798730
[Fact]
799731
public async Task ExecuteAsync_WithFailingStep_PreservesOriginalStackTrace()
800732
{
@@ -815,55 +747,6 @@ public async Task ExecuteAsync_WithFailingStep_PreservesOriginalStackTrace()
815747
Assert.Contains("ThrowHelperMethod", exception.InnerException.StackTrace);
816748
}
817749

818-
[Fact]
819-
public async Task ExecuteAsync_WithParallelSuccessfulAndFailingSteps_OnlyFailuresReported()
820-
{
821-
using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, publisher: "default", isDeploy: true);
822-
var pipeline = new DistributedApplicationPipeline();
823-
824-
var executedSteps = new List<string>();
825-
826-
pipeline.AddStep("success1", async (context) =>
827-
{
828-
lock (executedSteps) { executedSteps.Add("success1"); }
829-
await Task.CompletedTask;
830-
});
831-
832-
pipeline.AddStep("fail1", async (context) =>
833-
{
834-
lock (executedSteps) { executedSteps.Add("fail1"); }
835-
await Task.CompletedTask;
836-
throw new InvalidOperationException("Failure 1");
837-
});
838-
839-
pipeline.AddStep("success2", async (context) =>
840-
{
841-
lock (executedSteps) { executedSteps.Add("success2"); }
842-
await Task.CompletedTask;
843-
});
844-
845-
pipeline.AddStep("fail2", async (context) =>
846-
{
847-
lock (executedSteps) { executedSteps.Add("fail2"); }
848-
await Task.CompletedTask;
849-
throw new InvalidOperationException("Failure 2");
850-
});
851-
852-
var context = CreateDeployingContext(builder.Build());
853-
854-
var exception = await Assert.ThrowsAsync<AggregateException>(() => pipeline.ExecuteAsync(context));
855-
856-
// All steps should have attempted to execute
857-
Assert.Contains("success1", executedSteps);
858-
Assert.Contains("success2", executedSteps);
859-
Assert.Contains("fail1", executedSteps);
860-
Assert.Contains("fail2", executedSteps);
861-
862-
// Only failures should be in the exception
863-
Assert.Equal(2, exception.InnerExceptions.Count);
864-
Assert.All(exception.InnerExceptions, e => Assert.IsType<InvalidOperationException>(e));
865-
}
866-
867750
[Fact]
868751
public async Task PublishAsync_Deploy_WithNoResourcesAndNoPipelineSteps_ReturnsError()
869752
{
@@ -1323,66 +1206,6 @@ public async Task ExecuteAsync_WithDiamondDependency_ExecutesCorrectly()
13231206
Assert.True(executionTimes["D"] >= executionTimes["C"], "D should start after C completes");
13241207
}
13251208

1326-
[Fact]
1327-
public async Task ExecuteAsync_WithLongAndShortBranches_DoesNotBlockShortBranch()
1328-
{
1329-
// Test that a long-running branch doesn't block an independent short branch
1330-
// Pattern: A -> LongB, A -> ShortB -> C
1331-
// C should be able to complete while LongB is still running
1332-
using var builder = TestDistributedApplicationBuilder.Create(DistributedApplicationOperation.Publish, publisher: "default", isDeploy: true);
1333-
var pipeline = new DistributedApplicationPipeline();
1334-
1335-
var completionOrder = new List<string>();
1336-
var completionTimes = new Dictionary<string, DateTime>();
1337-
1338-
pipeline.AddStep("A", async (context) =>
1339-
{
1340-
await Task.Delay(10);
1341-
});
1342-
1343-
pipeline.AddStep("LongB", async (context) =>
1344-
{
1345-
await Task.Delay(100);
1346-
lock (completionOrder)
1347-
{
1348-
completionOrder.Add("LongB");
1349-
completionTimes["LongB"] = DateTime.UtcNow;
1350-
}
1351-
}, dependsOn: "A");
1352-
1353-
pipeline.AddStep("ShortB", async (context) =>
1354-
{
1355-
await Task.Delay(10);
1356-
lock (completionOrder)
1357-
{
1358-
completionOrder.Add("ShortB");
1359-
completionTimes["ShortB"] = DateTime.UtcNow;
1360-
}
1361-
}, dependsOn: "A");
1362-
1363-
pipeline.AddStep("C", async (context) =>
1364-
{
1365-
await Task.Delay(10);
1366-
lock (completionOrder)
1367-
{
1368-
completionOrder.Add("C");
1369-
completionTimes["C"] = DateTime.UtcNow;
1370-
}
1371-
}, dependsOn: "ShortB");
1372-
1373-
var context = CreateDeployingContext(builder.Build());
1374-
await pipeline.ExecuteAsync(context);
1375-
1376-
// C should complete before LongB (demonstrating improved concurrency)
1377-
var cIndex = completionOrder.IndexOf("C");
1378-
var longBIndex = completionOrder.IndexOf("LongB");
1379-
1380-
Assert.True(cIndex < longBIndex,
1381-
"C should complete before LongB (not blocked by long-running parallel branch)");
1382-
Assert.True(completionTimes["C"] < completionTimes["LongB"],
1383-
"C should complete before LongB based on timestamps");
1384-
}
1385-
13861209
private static DeployingContext CreateDeployingContext(DistributedApplication app)
13871210
{
13881211
return new DeployingContext(

0 commit comments

Comments
 (0)