mirror of
https://github.com/actions/runner.git
synced 2026-01-13 22:52:16 +08:00
Change systemd KillMode from process to mixed for better process cleanup
Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
This commit is contained in:
48
src/Test/L0/Misc/SystemdServiceTemplateL0.cs
Normal file
48
src/Test/L0/Misc/SystemdServiceTemplateL0.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace GitHub.Runner.Common.Tests.Misc
|
||||
{
|
||||
public sealed class SystemdServiceTemplateL0
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Common")]
|
||||
public void ServiceTemplate_ContainsExpectedKillMode()
|
||||
{
|
||||
// Arrange
|
||||
var templatePath = Path.Combine(TestUtil.GetSrcPath(), "Misc", "layoutbin", "actions.runner.service.template");
|
||||
|
||||
// Act
|
||||
var templateContent = File.ReadAllText(templatePath);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("KillMode=mixed", templateContent);
|
||||
Assert.Contains("KillSignal=SIGTERM", templateContent);
|
||||
Assert.Contains("TimeoutStopSec=5min", templateContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Common")]
|
||||
public void ServiceTemplate_HasValidStructure()
|
||||
{
|
||||
// Arrange
|
||||
var templatePath = Path.Combine(TestUtil.GetSrcPath(), "Misc", "layoutbin", "actions.runner.service.template");
|
||||
|
||||
// Act
|
||||
var templateContent = File.ReadAllText(templatePath);
|
||||
var lines = templateContent.Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("[Unit]", lines);
|
||||
Assert.Contains("[Service]", lines);
|
||||
Assert.Contains("[Install]", lines);
|
||||
Assert.Contains("Description={{Description}}", lines);
|
||||
Assert.Contains("ExecStart={{RunnerRoot}}/runsvc.sh", lines);
|
||||
Assert.Contains("User={{User}}", lines);
|
||||
Assert.Contains("WorkingDirectory={{RunnerRoot}}", lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user