Skip to content

Commit

Permalink
Don't use TempFolder if we don't need auto-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Aug 22, 2024
1 parent 5fe1d6d commit 52017e9
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/LfMerge.Core.Tests/E2E/E2ETestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ public E2ETestBase()
[OneTimeSetUp]
public async Task FixtureSetup()
{
// Ensure we don't delete top-level /tmp/LfMergeSRTests folder and data subfolder if they already exist
var tempPath = Path.Combine(Path.GetTempPath(), "LfMergeSRTests");
var rootTempFolder = Directory.Exists(tempPath) ? TemporaryFolder.TrackExisting(tempPath) : new TemporaryFolder(tempPath);
var testDataPath = Path.Combine(tempPath, "data");
TestDataFolder = Directory.Exists(testDataPath) ? TemporaryFolder.TrackExisting(testDataPath) : new TemporaryFolder(testDataPath);
var lcmDataPath = Path.Combine(tempPath, "lcm-common");
LcmDataFolder = Directory.Exists(lcmDataPath) ? TemporaryFolder.TrackExisting(lcmDataPath) : new TemporaryFolder(lcmDataPath);
Environment.SetEnvironmentVariable("FW_CommonAppData", LcmDataFolder.Path);

// But the folder for this specific test suite should be deleted if it already exists
// Ensure top-level /tmp/LfMergeSRTests folder and subfolders exist
var tempPath = Path.Join(Path.GetTempPath(), "LfMergeSRTests");
Directory.CreateDirectory(tempPath);
var testDataPath = Path.Join(tempPath, "data");
Directory.CreateDirectory(testDataPath);
var lcmDataPath = Path.Join(tempPath, "lcm-common");
Directory.CreateDirectory(lcmDataPath);
Environment.SetEnvironmentVariable("FW_CommonAppData", lcmDataPath);

var derivedClassName = this.GetType().Name;
TempFolderForClass = new TemporaryFolder(rootTempFolder, derivedClassName);
TempFolderForClass = new TemporaryFolder(Path.Join(tempPath, derivedClassName));

// Ensure sena-3.zip is available to all tests as a starting point
Sena3ZipPath = Path.Combine(TestDataFolder.Path, "sena-3.zip");
Sena3ZipPath = Path.Join(testDataPath, "sena-3.zip");
if (!File.Exists(Sena3ZipPath)) {
using var testEnv = new SRTestEnvironment(TempFolderForTest);
if (!await testEnv.IsLexBoxAvailable()) {
Expand Down Expand Up @@ -191,7 +190,7 @@ public async Task<LanguageForgeProject> CreateLfProjectFromSena3()
var projCode = await CreateNewProjectFromSena3();
var projPath = CloneRepoFromLexbox(projCode, waitTime:TimeSpan.FromSeconds(5));
MercurialTestHelper.ChangeBranch(projPath, "tip");
var fwdataPath = Path.Combine(projPath, $"{projCode}.fwdata");
var fwdataPath = Path.Join(projPath, $"{projCode}.fwdata");
LfMergeBridge.LfMergeBridge.ReassembleFwdataFile(TestEnv.NullProgress, false, fwdataPath);

// Do an initial clone from LexBox to the mock LF
Expand Down

0 comments on commit 52017e9

Please sign in to comment.