Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ private void UndefinedHOME_getpwuidFallback()
DirectoryInfo expectedExtractDir = sharedTestState.SelfContainedApp.GetExtractionDir(Path.Combine(home, ".net"), bundledApp.Manifest);
var extractedFiles = GetExpectedExtractedFiles(bundledApp.Manifest, bundledApp.Options);
expectedExtractDir.Should().HaveFiles(extractedFiles);

// Extraction directory for this test is not associated with the SingleFileTestApp, so we need to explicitly delete it.
Directory.Delete(expectedExtractDir.FullName, recursive: true);
}

private static List<string> GetExpectedExtractedFiles(Manifest manifest, BundleOptions bundleOptions)
Expand Down
16 changes: 10 additions & 6 deletions src/installer/tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ public BundledAppWithSubDirs(SharedTestState fixture)
sharedTestState = fixture;
}

private FluentAssertions.AndConstraint<CommandResultAssertions> RunTheApp(string path, bool selfContained, bool deleteExtracted = true)
private FluentAssertions.AndConstraint<CommandResultAssertions> RunTheApp(string path, bool selfContained, bool deleteApp = true)
{
CommandResult result = Command.Create(path)
.EnableTracingAndCaptureOutputs()
.DotNetRoot(selfContained ? null : TestContext.BuiltDotNet.BinPath)
.MultilevelLookup(false)
.Execute();
if (deleteExtracted)
if (deleteApp)
{
DeleteExtractionDirectory(result);

// Delete the bundled app itself. It would already be cleaned up after all tests in this class run, but
// we do this early for test environments that may not have enough space for all the bundled apps at once.
FileUtils.DeleteFileIfPossible(path);
}

return result.Should().Pass()
Expand Down Expand Up @@ -65,7 +69,7 @@ public void FrameworkDependent(BundleOptions options)

// Run the bundled app
bool shouldExtract = options.HasFlag(BundleOptions.BundleAllContent);
RunTheApp(singleFile, selfContained: false, deleteExtracted: !shouldExtract)
RunTheApp(singleFile, selfContained: false, deleteApp: !shouldExtract)
.And.CreateExtraction(shouldExtract);

if (shouldExtract)
Expand All @@ -87,7 +91,7 @@ public void SelfContained(BundleOptions options)

// Run the bundled app
bool shouldExtract = options.HasFlag(BundleOptions.BundleAllContent);
RunTheApp(singleFile, selfContained: true, deleteExtracted: !shouldExtract)
RunTheApp(singleFile, selfContained: true, deleteApp: !shouldExtract)
.And.CreateExtraction(shouldExtract);

if (shouldExtract)
Expand All @@ -107,7 +111,7 @@ public void SelfContained_Targeting50(BundleOptions options)

// Run the bundled app
bool shouldExtract = options.HasFlag(BundleOptions.BundleAllContent);
RunTheApp(singleFile, selfContained: true, deleteExtracted: !shouldExtract)
RunTheApp(singleFile, selfContained: true, deleteApp: !shouldExtract)
.And.CreateExtraction(shouldExtract);

if (shouldExtract)
Expand All @@ -127,7 +131,7 @@ public void FrameworkDependent_Targeting50(BundleOptions options)

// Run the bundled app
bool shouldExtract = options.HasFlag(BundleOptions.BundleAllContent);
RunTheApp(singleFile, selfContained: false, deleteExtracted: !shouldExtract)
RunTheApp(singleFile, selfContained: false, deleteApp: !shouldExtract)
.And.CreateExtraction(shouldExtract);

if (shouldExtract)
Expand Down