Skip to content

Commit 151e3c4

Browse files
committed
Fix log search and mark Scripts-dependent FastFetch tests
LatestGVFSLogShouldContain: Search all log files in the logs directory, not just the most recent one. Mount errors are logged by GVFS.Mount.exe in its own log file, not the verb's log file. FastFetchTests: Mark CanFetchAndCheckoutMultipleTimesUsingForceCheckoutFlag and ForceCheckoutRequiresCheckout as SkipInCI - both depend on a Scripts folder that no longer exists in the FunctionalTests/20201014 test branch. Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
1 parent 33d846a commit 151e3c4

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MountTests.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,26 @@ private void LatestGVFSLogShouldContain(string expectedMessage)
392392
string logsRoot = this.Enlistment.GVFSLogsRoot;
393393
logsRoot.ShouldBeADirectory(this.fileSystem);
394394

395-
string latestLog = Directory.GetFiles(logsRoot, "*.log")
396-
.OrderByDescending(f => File.GetLastWriteTimeUtc(f))
397-
.FirstOrDefault();
395+
// Mount errors may be in GVFS.Mount's log, not the verb's log.
396+
// Search all recent log files for the expected message.
397+
string[] logFiles = Directory.GetFiles(logsRoot, "*.log");
398+
logFiles.Length.ShouldBeAtLeast(1, "No GVFS log files found in " + logsRoot);
398399

399-
latestLog.ShouldNotBeNull("No GVFS log files found in " + logsRoot);
400-
string logContents = File.ReadAllText(latestLog);
401-
logContents.ShouldContain(expectedMessage);
400+
foreach (string logFile in logFiles)
401+
{
402+
string contents = File.ReadAllText(logFile);
403+
if (contents.Contains(expectedMessage))
404+
{
405+
return;
406+
}
407+
}
408+
409+
// Not found in any log — fail with the contents of the most recent log for diagnostics
410+
string latestLog = logFiles
411+
.OrderByDescending(f => File.GetLastWriteTimeUtc(f))
412+
.First();
413+
string latestContents = File.ReadAllText(latestLog);
414+
latestContents.ShouldContain(expectedMessage);
402415
}
403416

404417
private class MountSubfolders

GVFS/GVFS.FunctionalTests/Tests/FastFetchTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public void CanFetchAndCheckoutASingleFolderIntoEmptyGitRepo()
103103
}
104104

105105
[TestCase]
106+
[SkipInCI("Atrophied: test repo Scripts folder no longer exists on FunctionalTests/20201014 branch")]
106107
public void CanFetchAndCheckoutMultipleTimesUsingForceCheckoutFlag()
107108
{
108109
this.RunFastFetch($"--checkout --folders \"/GVFS\" -b {Settings.Default.Commitish}");
@@ -139,6 +140,7 @@ public void CanFetchAndCheckoutMultipleTimesUsingForceCheckoutFlag()
139140
}
140141

141142
[TestCase]
143+
[SkipInCI("Atrophied: test repo Scripts folder no longer exists on FunctionalTests/20201014 branch")]
142144
public void ForceCheckoutRequiresCheckout()
143145
{
144146
this.RunFastFetch($"--checkout --folders \"/Scripts\" -b {Settings.Default.Commitish}");

0 commit comments

Comments
 (0)