mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Compare commits
3 Commits
v2.298.1
...
avastancu/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cf42ea25a | ||
|
|
86d0ee8389 | ||
|
|
1379ed2c72 |
@@ -1 +1 @@
|
|||||||
2.298.1
|
<Update to ./src/runnerversion when creating release>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
var healthcheck = await ContainerHealthcheck(executionContext, container);
|
var healthcheck = await ContainerHealthcheck(executionContext, container);
|
||||||
|
|
||||||
if (!string.Equals(healthcheck, "healthy", StringComparison.OrdinalIgnoreCase))
|
if (!(string.Equals(healthcheck, "healthy", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(healthcheck)))
|
||||||
{
|
{
|
||||||
unhealthyContainers.Add(container);
|
unhealthyContainers.Add(container);
|
||||||
}
|
}
|
||||||
@@ -330,13 +330,13 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
if (!container.IsJobContainer && !container.FailedInitialization)
|
if (!container.IsJobContainer && !container.FailedInitialization)
|
||||||
{
|
{
|
||||||
executionContext.Output($"Print service container logs: {container.ContainerDisplayName}");
|
executionContext.Output($"Print service container logs: {container.ContainerDisplayName}");
|
||||||
|
|
||||||
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
int logsExitCode = await _dockerManager.DockerLogs(executionContext, container.ContainerId);
|
||||||
if (logsExitCode != 0)
|
if (logsExitCode != 0)
|
||||||
{
|
{
|
||||||
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
executionContext.Warning($"Docker logs fail with exit code {logsExitCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
executionContext.Output($"Stop and remove container: {container.ContainerDisplayName}");
|
executionContext.Output($"Stop and remove container: {container.ContainerDisplayName}");
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
private Mock<IJobServerQueue> serverQueue;
|
private Mock<IJobServerQueue> serverQueue;
|
||||||
private Mock<IPagingLogger> pagingLogger;
|
private Mock<IPagingLogger> pagingLogger;
|
||||||
private List<string> healthyDockerStatus = new List<string> { "healthy" };
|
private List<string> healthyDockerStatus = new List<string> { "healthy" };
|
||||||
|
private List<string> emptyDockerStatus = new List<string> { string.Empty };
|
||||||
private List<string> unhealthyDockerStatus = new List<string> { "unhealthy" };
|
private List<string> unhealthyDockerStatus = new List<string> { "unhealthy" };
|
||||||
private List<string> dockerLogs = new List<string> { "log1", "log2", "log3" };
|
private List<string> dockerLogs = new List<string> { "log1", "log2", "log3" };
|
||||||
|
|
||||||
@@ -81,6 +82,23 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[Trait("Level", "L0")]
|
||||||
|
[Trait("Category", "Worker")]
|
||||||
|
public async void RunServiceContainersHealthcheck_healthyServiceContainerWithoutHealthcheck_AssertSucceededTask()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
Setup();
|
||||||
|
_dockerManager.Setup(x => x.DockerInspect(_ec.Object, It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(emptyDockerStatus));
|
||||||
|
|
||||||
|
//Act
|
||||||
|
await containerOperationProvider.RunContainersHealthcheck(_ec.Object, containers);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.Equal(TaskResult.Succeeded, _ec.Object.Result ?? TaskResult.Succeeded);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void Setup([CallerMemberName] string testName = "")
|
private void Setup([CallerMemberName] string testName = "")
|
||||||
{
|
{
|
||||||
containers.Add(new ContainerInfo() { ContainerImage = "ubuntu:16.04" });
|
containers.Add(new ContainerInfo() { ContainerImage = "ubuntu:16.04" });
|
||||||
|
|||||||
Reference in New Issue
Block a user