Improve test robustness with path validation and named constant

Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-09 02:47:23 +00:00
parent 4b97e637f5
commit 81255a9ac1

View File

@@ -1107,8 +1107,12 @@ namespace GitHub.Runner.Common.Tests.Listener
// Place a file where the work directory should be - this blocks Directory.CreateDirectory
string parentPath = Path.GetDirectoryName(workPath);
Assert.NotNull(parentPath);
Assert.NotEmpty(parentPath);
Directory.CreateDirectory(parentPath);
File.WriteAllText(workPath, "blocking file content");
const string blockingFileContent = "test file blocking directory creation";
File.WriteAllText(workPath, blockingFileContent);
const int testPoolId = 12345;
const int testAgentId = 67890;