mirror of https://github.com/winsw/winsw
Increase config readability
parent
ab9f33d988
commit
c390ac5889
|
@ -21,7 +21,8 @@ namespace winswTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -48,21 +49,13 @@ workingdirectory: {ExpectedWorkingDirectory}";
|
||||||
[Test]
|
[Test]
|
||||||
public void IncorrectStartMode()
|
public void IncorrectStartMode()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
arguments: My Arguments
|
arguments: My Arguments
|
||||||
startMode: roll
|
startMode: roll";
|
||||||
log:
|
|
||||||
mode: roll
|
|
||||||
logpath: c:\logs
|
|
||||||
serviceaccount:
|
|
||||||
domain: {Domain}
|
|
||||||
user: {Username}
|
|
||||||
password: {Password}
|
|
||||||
allowservicelogon: {AllowServiceAccountLogonRight}
|
|
||||||
workingdirectory: {ExpectedWorkingDirectory}";
|
|
||||||
|
|
||||||
this._extendedServiceDescriptor = ServiceDescriptorYaml.FromYaml(yaml).Configurations;
|
this._extendedServiceDescriptor = ServiceDescriptorYaml.FromYaml(yaml).Configurations;
|
||||||
Assert.That(() => this._extendedServiceDescriptor.StartMode, Throws.ArgumentException);
|
Assert.That(() => this._extendedServiceDescriptor.StartMode, Throws.ArgumentException);
|
||||||
|
@ -71,21 +64,13 @@ workingdirectory: {ExpectedWorkingDirectory}";
|
||||||
[Test]
|
[Test]
|
||||||
public void ChangedStartMode()
|
public void ChangedStartMode()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
arguments: My Arguments
|
arguments: My Arguments
|
||||||
startMode: manual
|
startMode: manual";
|
||||||
log:
|
|
||||||
mode: roll
|
|
||||||
logpath: c:\logs
|
|
||||||
serviceaccount:
|
|
||||||
domain: {Domain}
|
|
||||||
user: {Username}
|
|
||||||
password: {Password}
|
|
||||||
allowservicelogon: {AllowServiceAccountLogonRight}
|
|
||||||
workingdirectory: {ExpectedWorkingDirectory}";
|
|
||||||
|
|
||||||
this._extendedServiceDescriptor = ServiceDescriptorYaml.FromYaml(yaml).Configurations;
|
this._extendedServiceDescriptor = ServiceDescriptorYaml.FromYaml(yaml).Configurations;
|
||||||
Assert.That(this._extendedServiceDescriptor.StartMode, Is.EqualTo(StartMode.Manual));
|
Assert.That(this._extendedServiceDescriptor.StartMode, Is.EqualTo(StartMode.Manual));
|
||||||
|
@ -121,21 +106,24 @@ workingdirectory: {ExpectedWorkingDirectory}";
|
||||||
[Test]
|
[Test]
|
||||||
public void Priority()
|
public void Priority()
|
||||||
{
|
{
|
||||||
var sd = ServiceDescriptorYaml.FromYaml(@"id: service.exe
|
var sd = ServiceDescriptorYaml.FromYaml(@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
priority: normal").Configurations;
|
priority: normal").Configurations;
|
||||||
Assert.That(sd.Priority, Is.EqualTo(ProcessPriorityClass.Normal));
|
Assert.That(sd.Priority, Is.EqualTo(ProcessPriorityClass.Normal));
|
||||||
|
|
||||||
sd = ServiceDescriptorYaml.FromYaml(@"id: service.exe
|
sd = ServiceDescriptorYaml.FromYaml(@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
priority: idle").Configurations;
|
priority: idle").Configurations;
|
||||||
Assert.That(sd.Priority, Is.EqualTo(ProcessPriorityClass.Idle));
|
Assert.That(sd.Priority, Is.EqualTo(ProcessPriorityClass.Idle));
|
||||||
|
|
||||||
sd = ServiceDescriptorYaml.FromYaml(@"id: service.exe
|
sd = ServiceDescriptorYaml.FromYaml(@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe").Configurations;
|
executable: node.exe").Configurations;
|
||||||
|
@ -151,7 +139,8 @@ executable: node.exe").Configurations;
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseStopParentProcessFirst()
|
public void CanParseStopParentProcessFirst()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -178,7 +167,8 @@ stopTimeout: 60sec";
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseStopTimeoutFromMinutes()
|
public void CanParseStopTimeoutFromMinutes()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -192,7 +182,8 @@ stopTimeout: 10min";
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseLogname()
|
public void CanParseLogname()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -207,7 +198,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseOutfileDisabled()
|
public void CanParseOutfileDisabled()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -222,7 +214,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseErrfileDisabled()
|
public void CanParseErrfileDisabled()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -237,7 +230,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseOutfilePattern()
|
public void CanParseOutfilePattern()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -252,7 +246,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void CanParseErrfilePattern()
|
public void CanParseErrfilePattern()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -267,7 +262,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void LogModeRollBySize()
|
public void LogModeRollBySize()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -290,7 +286,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void LogModeRollByTime()
|
public void LogModeRollByTime()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -313,7 +310,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void LogModeRollBySizeTime()
|
public void LogModeRollBySizeTime()
|
||||||
{
|
{
|
||||||
const string yaml = @"id: service.exe
|
const string yaml = @"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -338,7 +336,8 @@ log:
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifyServiceLogonRightGraceful()
|
public void VerifyServiceLogonRightGraceful()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -356,7 +355,8 @@ serviceaccount:
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifyServiceLogonRightOmitted()
|
public void VerifyServiceLogonRightOmitted()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -373,7 +373,8 @@ serviceaccount:
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifyWaitHint()
|
public void VerifyWaitHint()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -387,7 +388,8 @@ waitHint: 20 min";
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifySleepTime()
|
public void VerifySleepTime()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -401,7 +403,8 @@ sleepTime: 3 hrs";
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifyResetFailureAfter()
|
public void VerifyResetFailureAfter()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -415,7 +418,8 @@ resetFailureAfter: 75 sec";
|
||||||
[Test]
|
[Test]
|
||||||
public void VerifyStopTimeout()
|
public void VerifyStopTimeout()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -429,7 +433,8 @@ stopTimeout: 35 sec";
|
||||||
[Test]
|
[Test]
|
||||||
public void Arguments_LegacyParam()
|
public void Arguments_LegacyParam()
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -442,7 +447,8 @@ arguments: arg";
|
||||||
|
|
||||||
public void DelayedStart_RoundTrip(bool enabled)
|
public void DelayedStart_RoundTrip(bool enabled)
|
||||||
{
|
{
|
||||||
string yaml = $@"id: service.exe
|
string yaml = $@"
|
||||||
|
id: service.exe
|
||||||
name: Service
|
name: Service
|
||||||
description: The Service.
|
description: The Service.
|
||||||
executable: node.exe
|
executable: node.exe
|
||||||
|
@ -457,7 +463,8 @@ delayedAutoStart: true";
|
||||||
[Test]
|
[Test]
|
||||||
public void Must_Specify_Values_Test()
|
public void Must_Specify_Values_Test()
|
||||||
{
|
{
|
||||||
var yml = @"name: This is a test
|
var yml = @"
|
||||||
|
name: This is a test
|
||||||
executable: 'C:\Program Files\Java\jdk1.8.0_241\bin\java.exe'
|
executable: 'C:\Program Files\Java\jdk1.8.0_241\bin\java.exe'
|
||||||
description: This is test winsw";
|
description: This is test winsw";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue