mirror of
https://github.com/actions/runner.git
synced 2026-02-09 14:52:06 +08:00
Compare commits
2 Commits
copilot/su
...
users/tihu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b47280d1d | ||
|
|
4214709d1b |
@@ -28,8 +28,8 @@ Debian based OS (Debian, Ubuntu, Linux Mint)
|
||||
- liblttng-ust1 or liblttng-ust0
|
||||
- libkrb5-3
|
||||
- zlib1g
|
||||
- libssl1.1, libssl1.0.2 or libssl1.0.0
|
||||
- libicu63, libicu60, libicu57 or libicu55
|
||||
- libssl3t64, libssl3, libssl1.1, libssl1.0.2 or libssl1.0.0
|
||||
- libicu76, libicu75, ..., libicu66, libicu65, libicu63, libicu60, libicu57, libicu55, or libicu52
|
||||
|
||||
Fedora based OS (Fedora, Red Hat Enterprise Linux, CentOS, Oracle Linux 7)
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt_get_with_fallbacks libssl1.1$ libssl1.0.2$ libssl1.0.0$
|
||||
apt_get_with_fallbacks libssl3t64$ libssl3$ libssl1.1$ libssl1.0.2$ libssl1.0.0$
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'$apt_get' failed with exit code '$?'"
|
||||
|
||||
@@ -1076,75 +1076,5 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
Assert.True(hc.AllowAuthMigration);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Runner")]
|
||||
public async Task RunCommand_ShouldReturnTerminatedError_WhenWorkDirCreationFails()
|
||||
{
|
||||
using (var hostCtx = new TestHostContext(this))
|
||||
{
|
||||
// Setup: arrange mocks and runner instance
|
||||
var runnerInstance = new Runner.Listener.Runner();
|
||||
hostCtx.SetSingleton<IConfigurationManager>(_configurationManager.Object);
|
||||
hostCtx.SetSingleton<IJobNotification>(_jobNotification.Object);
|
||||
hostCtx.SetSingleton<IMessageListener>(_messageListener.Object);
|
||||
hostCtx.SetSingleton<IPromptManager>(_promptManager.Object);
|
||||
hostCtx.SetSingleton<IConfigurationStore>(_configStore.Object);
|
||||
hostCtx.SetSingleton<IRunnerServer>(_runnerServer.Object);
|
||||
hostCtx.EnqueueInstance<IErrorThrottler>(_acquireJobThrottler.Object);
|
||||
|
||||
runnerInstance.Initialize(hostCtx);
|
||||
|
||||
// Create a file at the work directory path to block directory creation
|
||||
string workPath = hostCtx.GetDirectory(WellKnownDirectory.Work);
|
||||
|
||||
// Clean up any existing directory first
|
||||
if (Directory.Exists(workPath))
|
||||
{
|
||||
Directory.Delete(workPath, recursive: true);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
const string blockingFileContent = "test file blocking directory creation";
|
||||
File.WriteAllText(workPath, blockingFileContent);
|
||||
|
||||
const int testPoolId = 12345;
|
||||
const int testAgentId = 67890;
|
||||
|
||||
var runnerConfig = new RunnerSettings
|
||||
{
|
||||
PoolId = testPoolId,
|
||||
AgentId = testAgentId
|
||||
};
|
||||
|
||||
_configurationManager.Setup(m => m.LoadSettings()).Returns(runnerConfig);
|
||||
_configurationManager.Setup(m => m.IsConfigured()).Returns(true);
|
||||
_configStore.Setup(m => m.IsServiceConfigured()).Returns(false);
|
||||
|
||||
try
|
||||
{
|
||||
// Execute: run the command which should fail during work dir validation
|
||||
var cmd = new CommandSettings(hostCtx, new string[] { "run" });
|
||||
int exitCode = await runnerInstance.ExecuteCommand(cmd);
|
||||
|
||||
// Verify: should return TerminatedError code when dir creation fails
|
||||
Assert.Equal(Constants.Runner.ReturnCode.TerminatedError, exitCode);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Cleanup: remove the blocking file
|
||||
if (File.Exists(workPath))
|
||||
{
|
||||
File.Delete(workPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user