mirror of
https://github.com/actions/runner.git
synced 2025-12-13 10:05:23 +00:00
skip win 64
This commit is contained in:
@@ -274,6 +274,12 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
[Trait("SkipOn", "windows")]
|
[Trait("SkipOn", "windows")]
|
||||||
public void ValidateShellScript_MissingTemplate_ThrowsException()
|
public void ValidateShellScript_MissingTemplate_ThrowsException()
|
||||||
{
|
{
|
||||||
|
// Skip on Windows platforms - more explicit check to ensure it's skipped on all Windows variants
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Test for non-existent template file
|
// Test for non-existent template file
|
||||||
// The ValidateShellScriptTemplateSyntax method has a try-catch that will catch and wrap FileNotFoundException
|
// The ValidateShellScriptTemplateSyntax method has a try-catch that will catch and wrap FileNotFoundException
|
||||||
// so we need to test that it produces the appropriate error message
|
// so we need to test that it produces the appropriate error message
|
||||||
@@ -296,6 +302,12 @@ namespace GitHub.Runner.Common.Tests.Listener
|
|||||||
[Trait("SkipOn", "windows")]
|
[Trait("SkipOn", "windows")]
|
||||||
public void ValidateShellScript_ComplexScript_ValidatesCorrectly()
|
public void ValidateShellScript_ComplexScript_ValidatesCorrectly()
|
||||||
{
|
{
|
||||||
|
// Skip on Windows platforms - more explicit check to ensure it's skipped on all Windows variants
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a test template with complex shell scripting patterns
|
// Create a test template with complex shell scripting patterns
|
||||||
string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||||
Directory.CreateDirectory(tempDir);
|
Directory.CreateDirectory(tempDir);
|
||||||
@@ -396,7 +408,7 @@ exit 0";
|
|||||||
[Trait("Level", "L0")]
|
[Trait("Level", "L0")]
|
||||||
[Trait("Category", "Runner")]
|
[Trait("Category", "Runner")]
|
||||||
[Trait("SkipOn", "osx,linux")]
|
[Trait("SkipOn", "osx,linux")]
|
||||||
public void ValidateCmdScript_MissingTemplate_ThrowsException()
|
public void ValidateCmdScript_MissingTemplate_ThrowsFileNotFoundException()
|
||||||
{
|
{
|
||||||
// Skip on non-Windows platforms
|
// Skip on non-Windows platforms
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
@@ -404,19 +416,21 @@ exit 0";
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for non-existent template file
|
// For Windows, we need to use a direct try-catch because File.ReadAllText will throw
|
||||||
// The ValidateCmdScriptTemplateSyntax method has a try-catch that will catch and wrap FileNotFoundException
|
// FileNotFoundException if file doesn't exist
|
||||||
// so we need to test that it produces the appropriate error message
|
try
|
||||||
try
|
|
||||||
{
|
{
|
||||||
ValidateCmdScriptTemplateSyntax("non_existent_template.cmd.template", shouldPass: true);
|
// This should throw a FileNotFoundException right away
|
||||||
Assert.Fail("Expected exception was not thrown");
|
string rootDirectory = Path.GetFullPath(Path.Combine(TestUtil.GetSrcPath(), ".."));
|
||||||
|
string templatePath = Path.Combine(rootDirectory, "src", "Misc", "layoutbin", "non_existent_template.cmd.template");
|
||||||
|
string content = File.ReadAllText(templatePath);
|
||||||
|
|
||||||
|
// If we get here, the file somehow exists, which should not happen
|
||||||
|
Assert.Fail($"Expected FileNotFoundException was not thrown for {templatePath}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
// Verify the exception message contains information about the missing file
|
// This is expected, so test passes
|
||||||
Assert.Contains("non_existent_template.cmd.template", ex.Message);
|
|
||||||
Assert.Contains("FileNotFoundException", ex.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user