From d469a125243b482842b08da33a1cb0414e6bcb7f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 6 Nov 2017 11:39:47 -0500 Subject: [PATCH 1/3] Fix PrePrepConfig not always being called when it needs to be --- TGServerService/Service.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TGServerService/Service.cs b/TGServerService/Service.cs index b9d8547453..13b1605af9 100644 --- a/TGServerService/Service.cs +++ b/TGServerService/Service.cs @@ -214,8 +214,6 @@ namespace TGServerService { var newVersion = Config.SettingsVersion; Config.Upgrade(); - - PrePrepConfig(); for (var oldVersion = Config.SettingsVersion; oldVersion < newVersion; ++oldVersion) MigrateSettings(oldVersion); @@ -225,6 +223,8 @@ namespace TGServerService Config.UpgradeRequired = false; Config.Save(); } + + PrePrepConfig(); } /// From 267759491cfff4ba3f96c26b710c282e0e1fa336 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 6 Nov 2017 12:15:01 -0500 Subject: [PATCH 2/3] Improves TestCommandLinePortSet --- TGServiceTests/Service/TestService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TGServiceTests/Service/TestService.cs b/TGServiceTests/Service/TestService.cs index 43d6f277f6..b5398c0610 100644 --- a/TGServiceTests/Service/TestService.cs +++ b/TGServiceTests/Service/TestService.cs @@ -37,11 +37,13 @@ namespace TGServerService.Tests [TestMethod] public void TestCommandLinePortSet() { + Properties.Settings.Default.RemoteAccessPort = 11111; using (var S = new ServiceAccessor()) { S.FakeStart(new string[] { "-port", "36785" }); S.FakeStop(); } + Assert.AreEqual(Properties.Settings.Default.RemoteAccessPort, 36785); } } } From 8b82ab039935b8dc23791e51987bf1492340694a Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 6 Nov 2017 12:18:25 -0500 Subject: [PATCH 3/3] Regression test for PrePrepConfig not always being called --- TGServiceTests/Service/TestService.cs | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/TGServiceTests/Service/TestService.cs b/TGServiceTests/Service/TestService.cs index b5398c0610..8c19056596 100644 --- a/TGServiceTests/Service/TestService.cs +++ b/TGServiceTests/Service/TestService.cs @@ -19,10 +19,9 @@ namespace TGServerService.Tests } /// - /// Test and can execute successfully + /// Starts and stops a /// - [TestMethod] - public void TestStartupAndShutdown() + void StartStopServiceBasic() { using (var S = new ServiceAccessor()) { @@ -30,6 +29,15 @@ namespace TGServerService.Tests S.FakeStop(); } } + + /// + /// Test and can execute successfully + /// + [TestMethod] + public void TestStartupAndShutdown() + { + StartStopServiceBasic(); + } /// /// Test and can execute successfully with a commandline port override @@ -45,5 +53,21 @@ namespace TGServerService.Tests } Assert.AreEqual(Properties.Settings.Default.RemoteAccessPort, 36785); } + + /// + /// Test that the .NET config is always initialized regardless of + /// + [TestMethod] + public void TestNETConfigIsAlwaysPrepped() + { + Properties.Settings.Default.UpgradeRequired = true; + Properties.Settings.Default.InstancePaths = null; + StartStopServiceBasic(); + Assert.IsNotNull(Properties.Settings.Default.InstancePaths); + Properties.Settings.Default.UpgradeRequired = false; + Properties.Settings.Default.InstancePaths = null; + StartStopServiceBasic(); + Assert.IsNotNull(Properties.Settings.Default.InstancePaths); + } } }