Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the flaky test #2395

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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 @@ -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);

Expand All @@ -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
{
Expand Down
Loading