From b2dc94d70406792fbcb4e44c74199f625c3034d3 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Wed, 16 Apr 2025 19:55:39 -0400 Subject: [PATCH] Fix tests --- build/package/deb/appsettings.GitHub.yml | 5 +- build/package/winget/appsettings.GitHub.yml | 5 +- .../Validators/SwarmConfigValidator.cs | 3 -- .../TestServiceCollectionExtensions.cs | 49 ------------------- .../Setup/TestSetupWizard.cs | 19 ------- 5 files changed, 8 insertions(+), 73 deletions(-) delete mode 100644 tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs diff --git a/build/package/deb/appsettings.GitHub.yml b/build/package/deb/appsettings.GitHub.yml index ae79a502fc..73aaf5534f 100644 --- a/build/package/deb/appsettings.GitHub.yml +++ b/build/package/deb/appsettings.GitHub.yml @@ -4,7 +4,8 @@ Database: ConnectionString: Data Source=/home/tgstation-server/tgs.sqlite3;Mode=ReadWriteCreate General: ConfigVersion: 4.6.0 - ApiPort: 5000 + ApiEndPoints: + - Port: 5000 GitHubAccessToken: SetupWizardMode: Never ByondTopicTimeout: 5000 @@ -19,6 +20,8 @@ General: UserLimit: 100 UserGroupLimit: 25 ValidInstancePaths: +Session: + BridgePort: 5000 FileLogging: Directory: Disable: false diff --git a/build/package/winget/appsettings.GitHub.yml b/build/package/winget/appsettings.GitHub.yml index 610a2ccd76..60bf724971 100644 --- a/build/package/winget/appsettings.GitHub.yml +++ b/build/package/winget/appsettings.GitHub.yml @@ -4,7 +4,8 @@ Database: ConnectionString: Data Source=/tgs.sqlite3;Mode=ReadWriteCreate General: ConfigVersion: 4.6.0 - ApiPort: 5000 + ApiEndPoints: + - Port: 5000 GitHubAccessToken: SetupWizardMode: Never ByondTopicTimeout: 5000 @@ -19,6 +20,8 @@ General: UserLimit: 100 UserGroupLimit: 25 ValidInstancePaths: +Session: + BridgePort: 5000 FileLogging: Directory: Disable: false diff --git a/src/Tgstation.Server.Host/Configuration/Validators/SwarmConfigValidator.cs b/src/Tgstation.Server.Host/Configuration/Validators/SwarmConfigValidator.cs index cb67d69606..0d2a759ca5 100644 --- a/src/Tgstation.Server.Host/Configuration/Validators/SwarmConfigValidator.cs +++ b/src/Tgstation.Server.Host/Configuration/Validators/SwarmConfigValidator.cs @@ -17,9 +17,6 @@ namespace Tgstation.Server.Host.Configuration.Validators if (options.PrivateKey == null) return ValidateOptionsResult.Success; - if (options.UpdateRequiredNodeCount == 0) - return ValidateOptionsResult.Fail($"{nameof(SwarmConfiguration.UpdateRequiredNodeCount)} must be greater than 0!"); - if (options.Address == null) return ValidateOptionsResult.Fail($"{nameof(SwarmConfiguration.Address)} must be set to an http endpoint of this swarm service accessible from other servers in the swarm!"); diff --git a/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs b/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs deleted file mode 100644 index 09c2bd502d..0000000000 --- a/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using System; - -namespace Tgstation.Server.Host.Extensions.Tests -{ - [TestClass] - public sealed class TestServiceCollectionExtensions - { - class GoodConfig - { - public const string Section = "asdf"; - } - - class BadConfig1 - { -#pragma warning disable IDE0051 // Remove unused private members - const string Section = "asdf"; -#pragma warning restore IDE0051 // Remove unused private members - } - - class BadConfig2 - { - public const bool Section = false; - } - - class BadConfig3 - { - //nah - } - - [TestMethod] - public void TestUseStandardConfig() - { - var serviceCollection = new ServiceCollection(); - var mockConfig = new Mock(); - mockConfig.Setup(x => x.GetSection(It.IsNotNull())).Returns(mockConfig.Object).Verifiable(); - Assert.ThrowsException(() => ServiceCollectionExtensions.UseStandardConfig(null, null)); - Assert.ThrowsException(() => serviceCollection.UseStandardConfig(null)); - serviceCollection.UseStandardConfig(mockConfig.Object); - Assert.ThrowsException(() => serviceCollection.UseStandardConfig(mockConfig.Object)); - Assert.ThrowsException(() => serviceCollection.UseStandardConfig(mockConfig.Object)); - Assert.ThrowsException(() => serviceCollection.UseStandardConfig(mockConfig.Object)); - mockConfig.Verify(); - } - } -} diff --git a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs index 01c86c1ebb..9053173817 100644 --- a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs +++ b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs @@ -193,8 +193,6 @@ namespace Tgstation.Server.Host.Setup.Tests //cp config "y", "y", - // swarm config - "n", // telemetry config "n", //saved, now for second run @@ -226,16 +224,6 @@ namespace Tgstation.Server.Host.Setup.Tests "y", "n", String.Empty, - //swarm config - "y", - "node1", - "not a url", - "net.tcp://notandhttpAddress.com", - "http://node1internal:3400", - "http://node1public:3400", - "privatekey", - "n", - "http://controller.com", // telemetry config "y", "telemetry name", @@ -270,13 +258,6 @@ namespace Tgstation.Server.Host.Setup.Tests "y", "n", "http://fake.com, https://example.org", - //swarm config - "y", - "controller", - "https://controllerinternal.com", - "https://controllerpublic.com", - "privatekey", - "y", // telemetry config "n", };