Skip to content

Commit d3d7275

Browse files
committed
fix: flaky RenameRegex fullpath test matching GUID in temp path
The Scope_fullpath_matches_entire_path_within_directory test used "abc" as its regex pattern. Since TempDirectory paths contain hex GUIDs, "abc" could randomly appear in the directory portion, causing the fullpath replacement to alter the directory and trigger PathGuard. Changed to "klm" (non-hex chars) so it can never match the temp directory path. Co-Authored-By: Rooty
1 parent cf11820 commit d3d7275

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/FlowForge.Tests/Nodes/RenameRegexNodeTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ public async Task Scope_filename_only_matches_filename_part()
7070
[Fact]
7171
public async Task Scope_fullpath_matches_entire_path_within_directory()
7272
{
73+
// Use non-hex characters (klm) so the pattern can't accidentally match
74+
// inside the hex GUID portion of the temp directory path.
7375
using var tempDir = new TempDirectory();
74-
tempDir.CreateFiles("abc_test.txt");
76+
tempDir.CreateFiles("klm_test.txt");
7577

76-
string filePath = Path.Combine(tempDir.Path, "abc_test.txt");
78+
string filePath = Path.Combine(tempDir.Path, "klm_test.txt");
7779
FileJob job = MakeJob(filePath);
7880

7981
var node = new RenameRegexNode(NullLogger<RenameRegexNode>.Instance);
80-
node.Configure(MakeConfig(new { pattern = "abc", replacement = "xyz", scope = "fullpath" }));
82+
node.Configure(MakeConfig(new { pattern = "klm", replacement = "xyz", scope = "fullpath" }));
8183

8284
IEnumerable<FileJob> result = await node.TransformAsync(job, dryRun: true);
8385

0 commit comments

Comments
 (0)