From 5c6d19e8b01a9775ac3a89310f6853e11c8083e0 Mon Sep 17 00:00:00 2001 From: erri120 Date: Tue, 17 Dec 2024 13:24:37 +0100 Subject: [PATCH] Use local temp directories --- .../LegacyDatabaseSupportTests.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/NexusMods.DataModel.SchemaVersions.Tests/LegacyDatabaseSupportTests.cs b/tests/NexusMods.DataModel.SchemaVersions.Tests/LegacyDatabaseSupportTests.cs index bc7c38c199..cd8f36eae7 100644 --- a/tests/NexusMods.DataModel.SchemaVersions.Tests/LegacyDatabaseSupportTests.cs +++ b/tests/NexusMods.DataModel.SchemaVersions.Tests/LegacyDatabaseSupportTests.cs @@ -14,7 +14,7 @@ namespace NexusMods.DataModel.SchemaVersions.Tests; -public class LegacyDatabaseSupportTests(IServiceProvider provider, TemporaryFileManager tempManager, IFileExtractor extractor) +public class LegacyDatabaseSupportTests(IServiceProvider provider, IFileExtractor extractor) { private readonly SignatureChecker _zipSignatureChecker = new(FileType.ZIP); @@ -30,14 +30,20 @@ public async Task TestDatabase(string name) var isZip = await _zipSignatureChecker.MatchesAnyAsync(stream); isZip.Should().BeTrue("the database file should be a ZIP archive, you may need to pull the file from LFS (`git lfs pull`)"); } - - await using var workingFolder = tempManager.CreateFolder(); + + var basePath = FileSystem.Shared.GetKnownPath(KnownPath.EntryDirectory).Combine("Temp").Combine($"Test-{Guid.NewGuid()}"); + basePath.CreateDirectory(); + basePath.DirectoryExists().Should().BeTrue(); + + using var temporaryFileManager = new TemporaryFileManager(FileSystem.Shared, basePath: basePath); + + await using var workingFolder = temporaryFileManager.CreateFolder(); await extractor.ExtractAllAsync(path, workingFolder.Path); - + var datamodelFolder = workingFolder.Path.Combine("MnemonicDB.rocksdb"); datamodelFolder.DirectoryExists().Should().BeTrue("the extracted database folder should exist"); datamodelFolder.EnumerateFiles().Should().NotBeEmpty("the extracted database folder should contain files"); - + using var backend = new Backend(); var settings = new DatomStoreSettings {