mirror of
https://github.com/actions/runner.git
synced 2026-03-12 17:57:13 -04:00
Improve test robustness with path validation and named constant
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user