From 9d208b2ac86028c666a8d31e7f285d14c1fe636a Mon Sep 17 00:00:00 2001 From: operate-services-sdk-bot Date: Mon, 9 Dec 2024 09:45:59 +0000 Subject: [PATCH] Release v1.7.0 --- CHANGELOG.md | 14 + Samples/Deploy/Matchmaker/queue.mmq | 37 +-- Samples/Deploy/Triggers/my-triggers.tr | 7 + .../GameServerHostingUnitTestsConstants.cs | 2 + .../Handlers/FleetUpdateHandlerTests.cs | 47 ++- .../Mocks/GameServerHostingFleetsApiV1Mock.cs | 31 +- .../Exceptions/InvalidConfigException.cs | 2 +- .../GameServerHostingModule.cs | 84 +++--- .../Handlers/FleetUpdateHandler.cs | 13 +- ...nity.Services.Cli.GameServerHosting.csproj | 2 +- ...Services.Cli.Integration.MockServer.csproj | 2 +- .../Authoring/Fetch/TriggersFetchTests.cs | 22 +- ...verHostingBuildConfigurationCreateTests.cs | 74 ++--- ...verHostingBuildConfigurationDeleteTests.cs | 34 +-- ...ServerHostingBuildConfigurationGetTests.cs | 42 +-- ...erverHostingBuildConfigurationListTests.cs | 26 +- ...verHostingBuildConfigurationUpdateTests.cs | 74 ++--- .../GameServerHostingBuildCreateTests.cs | 66 ++--- ...ameServerHostingBuildCreateVersionTests.cs | 46 +-- .../GameServerHostingBuildDeleteTests.cs | 42 +-- .../GameServerHostingBuildGetTests.cs | 42 +-- .../GameServerHostingBuildInstallsTests.cs | 42 +-- .../GameServerHostingBuildListTests.cs | 26 +- .../GameServerHostingBuildUpdateTests.cs | 26 +- ...eServerHostingFleetRegionAvailableTests.cs | 36 +-- ...GameServerHostingFleetRegionCreateTests.cs | 92 +++--- ...eServerHostingFleetRegionTemplatesTests.cs | 28 +- .../GameServerHostingFleetTests.cs | 274 +++++++++--------- .../GameServerHostingMachineListTest.cs | 26 +- ...ameServerHostingServerFileDownloadTests.cs | 26 +- .../GameServerHostingServerFilesTests.cs | 32 +- .../GameServerHostingServerGetTests.cs | 40 +-- .../GameServerHostingServerListTest.cs | 48 +-- .../LobbyTests/LobbyTests.cs | 16 +- .../Handlers/ConfigUpdateHandlerTests.cs | 34 ++- .../Handlers/ExportHandlerTests.cs | 10 +- .../Handlers/ImportHandlerTests.cs | 170 +++++++---- .../Handlers/LobbyConfigTests.cs | 12 +- .../Handlers/Config/ConfigSchemaV2.cs | 15 + .../Handlers/Config/LobbyConfig.cs | 138 +++++++++ .../Config/lobby-config-schema-v2.json | 74 +++++ .../Handlers/Config/lobby-config-schema.json | 54 ++-- .../Handlers/ConfigUpdateHandler.cs | 22 +- .../Handlers/ImportExport/LobbyConfig.cs | 88 ------ .../Handlers/ImportExport/LobbyExporter.cs | 1 + .../Handlers/ImportExport/LobbyImporter.cs | 25 +- .../Handlers/LobbyConstants.cs | 2 + .../Unity.Services.Cli.Lobby.csproj | 1 + .../SampleConfigs/TemplateQueueConfig.json | 32 +- .../Service/QueueConfigTemplate.cs | 30 +- .../Deploy/TriggerClientTests.cs | 4 +- .../Deploy/TriggerDeploymentHandlerTests.cs | 14 +- .../Deploy/TriggerFetchHandlerTests.cs | 14 +- .../Deploy/TriggerFetchServiceTests.cs | 4 +- .../Service/TriggersServiceTests.cs | 4 +- ...nity.Services.Cli.Triggers.UnitTest.csproj | 2 +- .../Deploy/TriggersClient.cs | 7 +- .../Deploy/TriggersConfigFile.cs | 5 +- .../Unity.Services.Cli.Triggers.csproj | 2 +- .../Unity.Services.Cli.csproj | 2 +- .../Model/ITriggerConfig.cs | 1 + .../Model/TriggerConfig.cs | 8 +- 62 files changed, 1267 insertions(+), 929 deletions(-) create mode 100644 Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchemaV2.cs create mode 100644 Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/LobbyConfig.cs create mode 100644 Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema-v2.json delete mode 100644 Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyConfig.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 134cebe..4dcf194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ All notable changes to UGS CLI will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.7.0] - 2024-11-25 + +### Fixed +- [Multiplay Hosting] Fixed issue with fleet usage settings being deleted if not provided in the update command. +- [CCD] Fixed issue with inconsistencies in paths when a customer uses more than one OS. + +### Changed +- [Multiplay Hosting] Updated all docs, commands and prompts to use the term "Multiplay Hosting" instead of "Game Server Hosting" as per the new branding. Directories and file names have not been changed as they are not user-facing. +- [Lobby] Supports new `lobbyv2` configuration schema on all config related commands. + +### Added +- [Triggers] Added filter support to service configs + ## [1.6.0] - 2024-07-18 ### Changed diff --git a/Samples/Deploy/Matchmaker/queue.mmq b/Samples/Deploy/Matchmaker/queue.mmq index d080c7f..d6a5a1a 100644 --- a/Samples/Deploy/Matchmaker/queue.mmq +++ b/Samples/Deploy/Matchmaker/queue.mmq @@ -26,41 +26,16 @@ "teamRules": [] } ], - "matchRules": [ - { - "source": "Players.ExternalData.CloudSave.Skill", - "name": "skill-diff", - "type": "Difference", - "reference": 500, - "overlap": 0.0, - "enableRule": false, - "not": false, - "relaxations": [] - }, - { - "source": "Players.QosResults.Latency", - "name": "QoS", - "type": "LessThanEqual", - "reference": 100, - "overlap": 0.0, - "enableRule": false, - "not": false, - "relaxations": [ - { - "type": "ReferenceControl.Replace", - "ageType": "Oldest", - "atSeconds": 30.0, - "value": 200 - } - ] - } - ] + "matchRules": [] }, - "name": "Default Pool Rules", + "name": "Rules", "backfillEnabled": false }, "matchHosting": { - "type": "MatchId", + "type": "Multiplay", + "fleetName" : "my fleet", + "buildConfigurationName" : "my build configuration", + "defaultQoSRegionName" : "North America" } }, "filteredPools": [] diff --git a/Samples/Deploy/Triggers/my-triggers.tr b/Samples/Deploy/Triggers/my-triggers.tr index 5ecd880..b3ca8d4 100644 --- a/Samples/Deploy/Triggers/my-triggers.tr +++ b/Samples/Deploy/Triggers/my-triggers.tr @@ -11,6 +11,13 @@ "EventType": "EventType2", "ActionType": "cloud-code", "ActionUrn": "urn:ugs:cloud-code:MyModule/MyFunction" + }, + { + "Name": "Trigger 3", + "EventType": "EventType3", + "ActionType": "cloud-code", + "ActionUrn": "urn:ugs:cloud-code:MyModule/MyFunction", + "Filter": "data['leaderboardId] == 'some-leaderboard-id'" } ] } diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/GameServerHostingUnitTestsConstants.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/GameServerHostingUnitTestsConstants.cs index d6cfbd5..d9e397c 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/GameServerHostingUnitTestsConstants.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/GameServerHostingUnitTestsConstants.cs @@ -33,11 +33,13 @@ public static class GameServerHostingUnitTestsConstants // Fleet specific constants public const string ValidFleetId = "00000000-0000-0000-1000-000000000000"; public const string ValidFleetId2 = "00000000-0000-0000-1100-000000000000"; + public const string ValidFleetId3 = "00000000-0000-0000-3300-000000000000"; public const string InvalidFleetId = "00000000-0000-0000-2222-000000000000"; public const string ValidFleetName = "Fleet One"; public const string ValidFleetName2 = "Fleet Two"; + public const string ValidFleetName3 = "Fleet Three"; public const string OsNameLinux = "Linux"; public const string OsNameFullNameLinux = "Ubuntu (Server) 22.04 LTS"; diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Handlers/FleetUpdateHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Handlers/FleetUpdateHandlerTests.cs index 5928078..124b022 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Handlers/FleetUpdateHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Handlers/FleetUpdateHandlerTests.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; using Spectre.Console; using Unity.Services.Cli.Common.Console; +using Unity.Services.Cli.Common.Exceptions; using Unity.Services.Cli.Common.Logging; using Unity.Services.Cli.GameServerHosting.Exceptions; using Unity.Services.Cli.GameServerHosting.Handlers; @@ -86,6 +87,44 @@ string fleetId TestsHelper.VerifyLoggerWasCalled(MockLogger!, LogLevel.Critical, LoggerExtension.ResultEventId, Times.Never); } + [TestCase(ValidProjectId, ValidEnvironmentName, ValidFleetId3)] + public void FleetUpdateAsync_NullFleetUsageSettingsThrowsException( + string projectId, + string environmentName, + string fleetId + ) + { + FleetUpdateInput input = new() + { + CloudProjectId = projectId, + TargetEnvironmentName = environmentName, + FleetId = fleetId, + Name = ValidFleetName, + AllocTtl = 0, + DeleteTtl = 0, + BuildConfigs = new List() { 1 }, + DisabledDeleteTtl = 0, + ShutdownTtl = 0, + }; + + Assert.ThrowsAsync(() => + FleetUpdateHandler.FleetUpdateAsync( + input, + MockUnityEnvironment.Object, + GameServerHostingService!, + MockLogger!.Object, + CancellationToken.None + ) + ); + + FleetsApi!.DefaultFleetsClient.Verify(api => api.UpdateFleetAsync( + It.IsAny(), It.IsAny(), + It.IsAny(), null, 0, CancellationToken.None + ), Times.Never); + + TestsHelper.VerifyLoggerWasCalled(MockLogger!, LogLevel.Critical, LoggerExtension.ResultEventId, Times.Never); + } + [TestCase(ValidProjectId, ValidEnvironmentName, ValidFleetId)] public async Task FleetUpdateAsync_CallsUpdateService( string projectId, @@ -153,7 +192,9 @@ await FleetUpdateHandler.FleetUpdateAsync( CancellationToken.None ); - FleetUpdateRequest expected = new FleetUpdateRequest(name: input.Name, buildConfigurations: input.BuildConfigs); + var usageSetting = JsonConvert.DeserializeObject(ValidUsageSettingsJson); + + FleetUpdateRequest expected = new FleetUpdateRequest(name: input.Name, buildConfigurations: input.BuildConfigs, usageSettings: new List { usageSetting! }); FleetsApi!.DefaultFleetsClient.Verify(api => api.UpdateFleetAsync( new Guid(input.CloudProjectId), new Guid(ValidEnvironmentId), @@ -224,8 +265,10 @@ await FleetUpdateHandler.FleetUpdateAsync( CancellationToken.None ); + var usageSetting = JsonConvert.DeserializeObject(ValidUsageSettingsJson); + FleetUpdateRequest expected = - new FleetUpdateRequest(name: ValidFleetName, buildConfigurations: new List() { 1 }); + new FleetUpdateRequest(name: ValidFleetName, buildConfigurations: new List() { 1 }, usageSettings: new List { usageSetting! }); FleetsApi!.DefaultFleetsClient.Verify(api => api.UpdateFleetAsync( new Guid(input.CloudProjectId), new Guid(ValidEnvironmentId), diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Mocks/GameServerHostingFleetsApiV1Mock.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Mocks/GameServerHostingFleetsApiV1Mock.cs index cc810d5..a460727 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Mocks/GameServerHostingFleetsApiV1Mock.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Mocks/GameServerHostingFleetsApiV1Mock.cs @@ -61,6 +61,17 @@ class GameServerHostingFleetsApiV1Mock ) }; + static readonly List k_TestFleetUsageSettings = new() + { + new FleetUsageSetting( + fleetUsageID: 0L, + hardwareType: FleetUsageSetting.HardwareTypeEnum.CLOUD, + machineType: "GCP-N2", + maxServersPerMachine: 5L, + memory: 0L, + speed: 0L) + }; + static readonly List k_TestFleets = new() { new Fleet( @@ -80,7 +91,8 @@ class GameServerHostingFleetsApiV1Mock allocationTTL: 10, deleteTTL: 20, disabledDeleteTTL: 25, - shutdownTTL: 30 + shutdownTTL: 30, + usageSettings: k_TestFleetUsageSettings ), new Fleet( buildConfigurations: new List(), @@ -96,6 +108,23 @@ class GameServerHostingFleetsApiV1Mock allocationTTL: 1, deleteTTL: 2, disabledDeleteTTL: 3, + shutdownTTL: 4, + usageSettings: k_TestFleetUsageSettings + ), + new Fleet( + buildConfigurations: new List(), + graceful: false, + fleetRegions: new List(), + id: new Guid(ValidFleetId3), + name: ValidFleetName3, + osFamily: Fleet.OsFamilyEnum.LINUX, + osName: OsNameLinux, + servers: new Servers(new FleetServerBreakdown(new ServerStatus()), + new FleetServerBreakdown(new ServerStatus()), new FleetServerBreakdown(new ServerStatus())), + status: Fleet.StatusEnum.ONLINE, + allocationTTL: 1, + deleteTTL: 2, + disabledDeleteTTL: 3, shutdownTTL: 4 ) }; diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidConfigException.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidConfigException.cs index 69f76a0..f4fe989 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidConfigException.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidConfigException.cs @@ -6,5 +6,5 @@ namespace Unity.Services.Cli.GameServerHosting.Exceptions; public class InvalidConfigException : CliException { public InvalidConfigException(string path) - : base($"Game Server Hosting Config file is invalid. See output for details: {path}", Common.Exceptions.ExitCode.HandledError) { } + : base($"Multiplay Hosting Config file is invalid. See output for details: {path}", Common.Exceptions.ExitCode.HandledError) { } } diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/GameServerHostingModule.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/GameServerHostingModule.cs index afdc7d6..098d609 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/GameServerHostingModule.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/GameServerHostingModule.cs @@ -34,7 +34,7 @@ public class GameServerHostingModule : ICommandModule { public GameServerHostingModule() { - BuildCreateCommand = new Command("create", "Create a Game Server Hosting build.") + BuildCreateCommand = new Command("create", "Create a Multiplay Hosting build.") { BuildCreateInput.BuildNameOption, BuildCreateInput.BuildOsFamilyOption, @@ -53,7 +53,7 @@ public GameServerHostingModule() BuildCreateVersionCommand = new Command( "create-version", - "Create a new version of a Game Server Hosting build.") + "Create a new version of a Multiplay Hosting build.") { BuildCreateVersionInput.BuildIdArgument, CommonInput.EnvironmentNameOption, @@ -77,7 +77,7 @@ public GameServerHostingModule() CancellationToken >(BuildCreateVersionHandler.BuildCreateVersionAsync); - BuildDeleteCommand = new Command("delete", "Delete a Game Server Hosting build") + BuildDeleteCommand = new Command("delete", "Delete a Multiplay Hosting build") { BuildIdInput.BuildIdArgument, CommonInput.EnvironmentNameOption, @@ -92,7 +92,7 @@ public GameServerHostingModule() CancellationToken >(BuildDeleteHandler.BuildDeleteAsync); - BuildGetCommand = new Command("get", "Get a Game Server Hosting build.") + BuildGetCommand = new Command("get", "Get a Multiplay Hosting build.") { BuildIdInput.BuildIdArgument, CommonInput.EnvironmentNameOption, @@ -106,7 +106,7 @@ public GameServerHostingModule() CancellationToken >(BuildGetHandler.BuildGetAsync); - BuildInstallsCommand = new Command("installs", "List Game Server Hosting build installs") + BuildInstallsCommand = new Command("installs", "List Multiplay Hosting build installs") { BuildIdInput.BuildIdArgument, CommonInput.EnvironmentNameOption, @@ -121,7 +121,7 @@ public GameServerHostingModule() CancellationToken >(BuildInstallsHandler.BuildInstallsAsync); - BuildListCommand = new Command("list", "List Game Server Hosting builds.") + BuildListCommand = new Command("list", "List Multiplay Hosting builds.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption @@ -134,7 +134,7 @@ public GameServerHostingModule() CancellationToken >(BuildListHandler.BuildListAsync); - BuildUpdateCommand = new Command("update", "Update a Game Server Hosting build") + BuildUpdateCommand = new Command("update", "Update a Multiplay Hosting build") { BuildIdInput.BuildIdArgument, BuildUpdateInput.BuildNameOption, @@ -149,7 +149,7 @@ public GameServerHostingModule() CancellationToken >(BuildUpdateHandler.BuildUpdateAsync); - BuildCommand = new Command("build", "Manage Game Server Hosting builds.") + BuildCommand = new Command("build", "Manage Multiplay Hosting builds.") { BuildCreateCommand, BuildCreateVersionCommand, @@ -160,7 +160,7 @@ public GameServerHostingModule() BuildUpdateCommand }; - BuildConfigurationGetCommand = new Command("get", "Get a Game Server Hosting build configurations.") + BuildConfigurationGetCommand = new Command("get", "Get a Multiplay Hosting build configurations.") { BuildConfigurationIdInput.BuildConfigurationIdArgument, CommonInput.EnvironmentNameOption, @@ -175,7 +175,7 @@ public GameServerHostingModule() CancellationToken >(BuildConfigurationGetHandler.BuildConfigurationGetAsync); - BuildConfigurationCreateCommand = new Command("create", "Create a Game Server Hosting build configuration.") + BuildConfigurationCreateCommand = new Command("create", "Create a Multiplay Hosting build configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -199,7 +199,7 @@ public GameServerHostingModule() CancellationToken >(BuildConfigurationCreateHandler.BuildConfigurationCreateAsync); - BuildConfigurationDeleteCommand = new Command("delete", "Delete a Game Server Hosting build configurations.") + BuildConfigurationDeleteCommand = new Command("delete", "Delete a Multiplay Hosting build configurations.") { BuildConfigurationIdInput.BuildConfigurationIdArgument, CommonInput.EnvironmentNameOption, @@ -214,7 +214,7 @@ public GameServerHostingModule() CancellationToken >(BuildConfigurationDeleteHandler.BuildConfigurationDeleteAsync); - BuildConfigurationListCommand = new Command("list", "List Game Server Hosting build configurations.") + BuildConfigurationListCommand = new Command("list", "List Multiplay Hosting build configurations.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -230,7 +230,7 @@ public GameServerHostingModule() CancellationToken >(BuildConfigurationListHandler.BuildConfigurationListAsync); - BuildConfigurationUpdateCommand = new Command("update", "Update a Game Server Hosting build configuration.") + BuildConfigurationUpdateCommand = new Command("update", "Update a Multiplay Hosting build configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -257,7 +257,7 @@ public GameServerHostingModule() BuildConfigurationCommand = new Command( "build-configuration", - "Manage Game Server Hosting build configurations.") + "Manage Multiplay Hosting build configurations.") { BuildConfigurationGetCommand, BuildConfigurationCreateCommand, @@ -266,7 +266,7 @@ public GameServerHostingModule() BuildConfigurationUpdateCommand, }; - FleetCreateCommand = new Command("create", "Create Game Server Hosting fleet.") + FleetCreateCommand = new Command("create", "Create Multiplay Hosting fleet.") { FleetCreateInput.FleetNameOption, FleetCreateInput.FleetOsFamilyOption, @@ -286,7 +286,7 @@ public GameServerHostingModule() >(FleetCreateHandler.FleetCreateAsync); - FleetDeleteCommand = new Command("delete", "Delete a Game Server Hosting fleet.") + FleetDeleteCommand = new Command("delete", "Delete a Multiplay Hosting fleet.") { FleetIdInput.FleetIdArgument, CommonInput.EnvironmentNameOption, @@ -301,7 +301,7 @@ public GameServerHostingModule() CancellationToken >(FleetDeleteHandler.FleetDeleteAsync); - FleetGetCommand = new Command("get", "Get a Game Server Hosting fleet.") + FleetGetCommand = new Command("get", "Get a Multiplay Hosting fleet.") { FleetIdInput.FleetIdArgument, CommonInput.EnvironmentNameOption, @@ -316,7 +316,7 @@ public GameServerHostingModule() CancellationToken >(FleetGetHandler.FleetGetAsync); - FleetListCommand = new Command("list", "List Game Server Hosting fleets.") + FleetListCommand = new Command("list", "List Multiplay Hosting fleets.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption @@ -330,7 +330,7 @@ public GameServerHostingModule() CancellationToken >(FleetListHandler.FleetListAsync); - FleetUpdateCommand = new Command("update", "Update a Game Server Hosting fleet.") + FleetUpdateCommand = new Command("update", "Update a Multiplay Hosting fleet.") { FleetIdInput.FleetIdArgument, FleetUpdateInput.FleetNameOption, @@ -352,7 +352,7 @@ public GameServerHostingModule() CancellationToken >(FleetUpdateHandler.FleetUpdateAsync); - FleetCommand = new Command("fleet", "Manage Game Server Hosting fleets.") + FleetCommand = new Command("fleet", "Manage Multiplay Hosting fleets.") { FleetCreateCommand, FleetDeleteCommand, @@ -364,7 +364,7 @@ public GameServerHostingModule() FleetRegionTemplatesCommand = new Command( "templates", - "List Game Server Hosting templates for creating fleet regions.") + "List Multiplay Hosting templates for creating fleet regions.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption @@ -380,7 +380,7 @@ public GameServerHostingModule() FleetRegionAvailableCommand = new Command( "available", - "List Game Server Hosting available template regions for creating fleet regions.") + "List Multiplay Hosting available template regions for creating fleet regions.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -395,7 +395,7 @@ public GameServerHostingModule() CancellationToken >(RegionAvailableHandler.RegionAvailableAsync); - FleetRegionCreateCommand = new Command("create", "Create Game Server Hosting fleet regions.") + FleetRegionCreateCommand = new Command("create", "Create Multiplay Hosting fleet regions.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -413,7 +413,7 @@ public GameServerHostingModule() CancellationToken >(FleetRegionCreateHandler.FleetRegionCreateAsync); - FleetRegionUpdateCommand = new Command("update", "Update Game Server Hosting fleet region.") + FleetRegionUpdateCommand = new Command("update", "Update Multiplay Hosting fleet region.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -436,7 +436,7 @@ public GameServerHostingModule() CancellationToken >(FleetRegionUpdateHandler.FleetRegionUpdateAsync); - FleetRegionCommand = new Command("fleet-region", "Manage Game Server Hosting fleet regions.") + FleetRegionCommand = new Command("fleet-region", "Manage Multiplay Hosting fleet regions.") { FleetRegionTemplatesCommand, FleetRegionAvailableCommand, @@ -444,7 +444,7 @@ public GameServerHostingModule() FleetRegionUpdateCommand }; - MachineListCommand = new Command("list", "List Game Server Hosting machines.") + MachineListCommand = new Command("list", "List Multiplay Hosting machines.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -463,12 +463,12 @@ public GameServerHostingModule() CancellationToken >(MachineListHandler.MachineListAsync); - MachineCommand = new Command("machine", "Manage Game Server Hosting machines.") + MachineCommand = new Command("machine", "Manage Multiplay Hosting machines.") { MachineListCommand, }; - ServerGetCommand = new Command("get", "Get a Game Server Hosting server.") + ServerGetCommand = new Command("get", "Get a Multiplay Hosting server.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -483,7 +483,7 @@ public GameServerHostingModule() CancellationToken >(ServerGetHandler.ServerGetAsync); - ServerListCommand = new Command("list", "List Game Server Hosting servers.") + ServerListCommand = new Command("list", "List Multiplay Hosting servers.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -503,7 +503,7 @@ public GameServerHostingModule() ServerFilesDownloadCommand = new Command( "download", - "Download files for the provided Game Server Hosting server.") + "Download files for the provided Multiplay Hosting server.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -521,7 +521,7 @@ public GameServerHostingModule() CancellationToken >(FileDownloadHandler.FileDownloadAsync); - ServerFilesListCommand = new Command("list", "List of files for the provided Game Server Hosting servers.") + ServerFilesListCommand = new Command("list", "List of files for the provided Multiplay Hosting servers.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -540,34 +540,34 @@ public GameServerHostingModule() CancellationToken >(FileListHandler.FileListAsync); - ServerFilesCommand = new Command("files", "Manage Game Server Hosting server files.") + ServerFilesCommand = new Command("files", "Manage Multiplay Hosting server files.") { ServerFilesDownloadCommand, ServerFilesListCommand, }; - ServerCommand = new Command("server", "Manage Game Server Hosting servers.") + ServerCommand = new Command("server", "Manage Multiplay Hosting servers.") { ServerGetCommand, ServerListCommand, ServerFilesCommand, }; - CoreDumpGetCommand = new Command("get", "Get a Game Server Hosting core dump configuration.") + CoreDumpGetCommand = new Command("get", "Get a Multiplay Hosting core dump configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, FleetIdInput.FleetIdArgument, }; - CoreDumpDeleteCommand = new Command("delete", "Delete a Game Server Hosting core dump configuration.") + CoreDumpDeleteCommand = new Command("delete", "Delete a Multiplay Hosting core dump configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, FleetIdInput.FleetIdArgument, }; - CoreDumpCreateCommand = new Command("create", "Create a Game Server Hosting core dump configuration.") + CoreDumpCreateCommand = new Command("create", "Create a Multiplay Hosting core dump configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -578,7 +578,7 @@ public GameServerHostingModule() CoreDumpCreateInput.StateOption, }; - CoreDumpUpdateCommand = new Command("update", "Update a Game Server Hosting core dump configuration.") + CoreDumpUpdateCommand = new Command("update", "Update a Multiplay Hosting core dump configuration.") { CommonInput.EnvironmentNameOption, CommonInput.CloudProjectIdOption, @@ -627,7 +627,7 @@ public GameServerHostingModule() CancellationToken >(CoreDumpUpdateHandler.CoreDumpUpdateAsync); - CoreDumpCommand = new Command("core-dump", "Manage Game Server Hosting core dump configurations.") + CoreDumpCommand = new Command("core-dump", "Manage Multiplay Hosting core dump configurations.") { CoreDumpGetCommand, CoreDumpDeleteCommand, @@ -635,7 +635,8 @@ public GameServerHostingModule() CoreDumpUpdateCommand }; - ModuleRootCommand = new Command("game-server-hosting", "Manage Game Sever Hosting resources.") + + ModuleRootCommand = new Command("multiplay-hosting", "Manage Multiplay Hosting resources.") { BuildCommand, BuildConfigurationCommand, @@ -646,7 +647,9 @@ public GameServerHostingModule() ServerCommand, }; + ModuleRootCommand.AddAlias("mh"); ModuleRootCommand.AddAlias("gsh"); + ModuleRootCommand.AddAlias("game-server-hosting"); BuildCommand.AddAlias("b"); BuildConfigurationCommand.AddAlias("bc"); FleetCommand.AddAlias("f"); @@ -848,4 +851,7 @@ static void RegisterAuthoringServices(IServiceCollection serviceCollection) serviceCollection.AddTransient(); } + + + } diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Handlers/FleetUpdateHandler.cs b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Handlers/FleetUpdateHandler.cs index 424bc6d..401385e 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Handlers/FleetUpdateHandler.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Handlers/FleetUpdateHandler.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using Unity.Services.Cli.Common.Console; using Unity.Services.Cli.Common.Utils; +using Unity.Services.Cli.Common.Exceptions; using Unity.Services.Cli.GameServerHosting.Exceptions; using Unity.Services.Cli.GameServerHosting.Input; using Unity.Services.Cli.GameServerHosting.Service; @@ -62,10 +63,20 @@ internal static async Task FleetUpdateAsync(FleetUpdateInput input, IUnityEnviro }; // If provided, include usage settings - if (usageSettings != null) + if (usageSettings?.Count > 0) { fleetUpdateReq.UsageSettings = usageSettings.Select(setting => JsonConvert.DeserializeObject(setting)!).ToList(); } + else if (fleet.UsageSettings?.Count > 0) + { + // pass UsageSettings from initial fleet GET request + fleetUpdateReq.UsageSettings = fleet.UsageSettings; + } + else + { + // No FleetUsage found. The customer needs to provide at least one for this fleet to be operational. + throw new CliException("Fleet does not have usage settings. At least 1 fleet usage must exist to be able to scale fleet up. ", ExitCode.HandledError); + } await service.FleetsApi.UpdateFleetAsync(Guid.Parse(input.CloudProjectId!), Guid.Parse(environmentId), Guid.Parse(fleetId), fleetUpdateReq, cancellationToken: cancellationToken); diff --git a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Unity.Services.Cli.GameServerHosting.csproj b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Unity.Services.Cli.GameServerHosting.csproj index cb676f6..537fe90 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Unity.Services.Cli.GameServerHosting.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Unity.Services.Cli.GameServerHosting.csproj @@ -7,7 +7,7 @@ true - FEATURE_GAME_SERVER_HOSTING_SERVER_FILE_LIST + FEATURE_GAME_SERVER_HOSTING_SERVER_FILE_LIST; diff --git a/Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/Unity.Services.Cli.Integration.MockServer.csproj b/Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/Unity.Services.Cli.Integration.MockServer.csproj index eecf0f7..cd2f868 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/Unity.Services.Cli.Integration.MockServer.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/Unity.Services.Cli.Integration.MockServer.csproj @@ -11,7 +11,7 @@ - + diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/Authoring/Fetch/TriggersFetchTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/Authoring/Fetch/TriggersFetchTests.cs index a7ee258..32a5828 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/Authoring/Fetch/TriggersFetchTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/Authoring/Fetch/TriggersFetchTests.cs @@ -37,27 +37,27 @@ public async Task SetUp() await MockApi.MockServiceAsync(new TriggersApiMock()); await MockApi.MockServiceAsync(new IdentityV1Mock()); Directory.CreateDirectory(k_TestDirectory); - m_LocalTriggers = new TriggerConfig[] - { - new ("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1") + m_LocalTriggers = + [ + new ("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1", "") { Path = Path.Combine(k_TestDirectory, "Trigger1.tr") } - }; + ]; - m_RemoteTriggers = new TriggerConfig[] - { - new ("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1") + m_RemoteTriggers = + [ + new ("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1", "") { Name = "Trigger1", Path = Path.Combine(k_TestDirectory, "Trigger1.tr") }, - new ("00000000-0000-0000-0000-000000000002", "Trigger2", "EventType2", "ActionType2", "ActionUrn2") + new ("00000000-0000-0000-0000-000000000002", "Trigger2", "EventType2", "ActionType2", "ActionUrn2", "") { Name = "Trigger2", Path = Path.Combine(k_TestDirectory, "Trigger2.tr") } - }; + ]; } [TearDown] @@ -78,7 +78,7 @@ static async Task CreateDeployFileAsync(IReadOnlyList testCases) { Configs = testCases .Select(c => new TriggerConfig( - c.Name, c.EventType, c.ActionType, c.ActionUrn)) + c.Name, c.EventType, c.ActionType, c.ActionUrn, c.Filter)) .ToList() }; var serialized = JsonConvert.SerializeObject(file); @@ -178,7 +178,7 @@ await GetFullySetCli() public async Task FetchToValidConfigFromDuplicateIdFails() { var localTriggers = m_LocalTriggers!.Append( - new TriggerConfig("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1") + new TriggerConfig("00000000-0000-0000-0000-000000000001", "Trigger1", "EventType1", "ActionType1", "ActionUrn1", "data['someId'] == 'thisId'") { Path = Path.Combine(k_TestDirectory, "Trigger1.tr") }).ToList(); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationCreateTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationCreateTests.cs index b51ae78..a6bd854 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationCreateTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationCreateTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_BuildConfigurationCreatePrefix = "gsh bc create "; + static readonly string k_BuildConfigurationCreatePrefix = "mh bc create "; [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_SucceedsWithValidInput() { await GetFullySetCli() @@ -29,9 +29,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -46,9 +46,9 @@ public async Task BuildConfigurationCreate_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -62,9 +62,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -77,9 +77,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingBinaryPathException() { await GetFullySetCli() @@ -90,9 +90,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingBuildException() { await GetFullySetCli() @@ -103,9 +103,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingCommandLineException() { await GetFullySetCli() @@ -116,9 +116,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingCoresException() { await GetFullySetCli() @@ -129,9 +129,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingMemoryException() { await GetFullySetCli() @@ -142,9 +142,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingNameException() { await GetFullySetCli() @@ -155,9 +155,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingQueryTypeException() { await GetFullySetCli() @@ -168,9 +168,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc create")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc create")] public async Task BuildConfigurationCreate_FailsMissingSpeedException() { await GetFullySetCli() diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationDeleteTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationDeleteTests.cs index 514cae0..5726b75 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationDeleteTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationDeleteTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_BuildConfigurationDeleteCommand = "gsh bc delete 1"; + static readonly string k_BuildConfigurationDeleteCommand = "mh bc delete 1"; [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc delete")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc delete")] public async Task BuildConfigurationDelete_SucceedsWithValidInput() { await GetFullySetCli() @@ -24,22 +24,22 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc delete")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc delete")] public async Task BuildConfigurationDelete_ThrowsMissingBuildConfigurationIdException() { await GetFullySetCli() - .Command("gsh bc delete") + .Command("mh bc delete") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'delete'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc delete")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc delete")] public async Task BuildConfigurationDelete_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -54,9 +54,9 @@ public async Task BuildConfigurationDelete_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc delete")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc delete")] public async Task BuildConfigurationDelete_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -70,9 +70,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc delete")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc delete")] public async Task BuildConfigurationDelete_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationGetTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationGetTests.cs index 589999e..c1cdcd2 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationGetTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationGetTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_BuildConfigurationGetCommand = "gsh bc get 1"; + static readonly string k_BuildConfigurationGetCommand = "mh bc get 1"; [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_SucceedsWithValidInput() { await GetFullySetCli() @@ -29,35 +29,35 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_ThrowsMissingBuildConfigurationIdException() { await GetFullySetCli() - .Command("gsh bc get") + .Command("mh bc get") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'get'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_ThrowsInvalidBuildConfigurationIdException() { await GetFullySetCli() - .Command("gsh bc get invalid-id") + .Command("mh bc get invalid-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Build Configuration ID 'invalid-id' not a valid ID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -72,9 +72,9 @@ public async Task BuildConfigurationGet_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -88,9 +88,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationGet_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationListTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationListTests.cs index 9aa143f..730e292 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationListTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationListTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_BuildConfigurationListCommand = "gsh bc list"; + static readonly string k_BuildConfigurationListCommand = "mh bc list"; [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc list")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc list")] public async Task BuildConfigurationList_SucceedsWithValidInput() { await GetFullySetCli() @@ -29,9 +29,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc list")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc list")] public async Task BuildConfigurationList_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -46,9 +46,9 @@ public async Task BuildConfigurationList_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc list")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc list")] public async Task BuildConfigurationList_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -62,9 +62,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc get")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc get")] public async Task BuildConfigurationList_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationUpdateTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationUpdateTests.cs index e62a755..9ed46c8 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationUpdateTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildConfigurationUpdateTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_BuildConfigurationUpdatePrefix = "gsh bc update 1 "; + static readonly string k_BuildConfigurationUpdatePrefix = "mh bc update 1 "; [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_SucceedsWithValidInput() { await GetFullySetCli() @@ -29,9 +29,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -46,9 +46,9 @@ public async Task BuildConfigurationUpdate_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -62,9 +62,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -77,9 +77,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingBinaryPathException() { await GetFullySetCli() @@ -90,9 +90,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingBuildException() { await GetFullySetCli() @@ -103,9 +103,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingCommandLineException() { await GetFullySetCli() @@ -116,9 +116,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingCoresException() { await GetFullySetCli() @@ -129,9 +129,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingMemoryException() { await GetFullySetCli() @@ -142,9 +142,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingNameException() { await GetFullySetCli() @@ -155,9 +155,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingQueryTypeException() { await GetFullySetCli() @@ -168,9 +168,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh bc")] - [Category("gsh bc update")] + [Category("mh")] + [Category("mh bc")] + [Category("mh bc update")] public async Task BuildConfigurationUpdate_FailsMissingSpeedException() { await GetFullySetCli() diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateTests.cs index b64a8a4..4be0d54 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildCreateCommand = "gsh build create --name test-build --os-family linux --type CONTAINER"; + const string k_BuildCreateCommand = "mh build create --name test-build --os-family linux --type CONTAINER"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_SucceedsWithValidInput() { await GetFullySetCli() @@ -29,39 +29,39 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_FailsMissingNameException() { await GetFullySetCli() - .Command("gsh build create --os-family linux --type CONTAINER") + .Command("mh build create --os-family linux --type CONTAINER") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--name' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsMissingOsFamilyException() { await GetFullySetCli() - .Command("gsh build create --name test-build --type CONTAINER") + .Command("mh build create --name test-build --type CONTAINER") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--os-family' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsInvalidTypeException() { await GetFullySetCli() - .Command("gsh build create --name test-build --os-family linux --type VM") + .Command("mh build create --name test-build --os-family linux --type VM") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains( "Invalid option for --type. Did you mean one of the following? FILEUPLOAD, CONTAINER, S3, GCS") @@ -69,35 +69,35 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsMissingTypeException() { await GetFullySetCli() - .Command("gsh build create --name test-build --os-family linux") + .Command("mh build create --name test-build --os-family linux") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--type' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsInvalidOsFamilyException() { await GetFullySetCli() - .Command("gsh build create --name test-build --os-family solaris --type CONTAINER") + .Command("mh build create --name test-build --os-family solaris --type CONTAINER") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Invalid option for --os-family. Did you mean one of the following? LINUX") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -112,9 +112,9 @@ public async Task BuildCreate_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -127,9 +127,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create")] public async Task BuildCreate_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateVersionTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateVersionTests.cs index 6ff9c39..a6c497b 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateVersionTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildCreateVersionTests.cs @@ -8,14 +8,14 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildCreateVersionCommand = "gsh build create-version"; + const string k_BuildCreateVersionCommand = "mh build create-version"; const string k_BuildCreateVersionBucketArgs = " 101 --access-key test-access-key --secret-key test-secret-key --bucket-url test-bucket-url"; const string k_BuildCreateVersionContainerArgs = " 102 --tag v1"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_Bucket_SucceedsWithValidInput() { await GetFullySetCli() @@ -26,9 +26,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_Container_SucceedsWithValidInput() { await GetFullySetCli() @@ -39,9 +39,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_FileUpload_SucceedsWithValidInput() { var args = " 103 --directory " + m_TempDirectoryPath; @@ -53,22 +53,22 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_ThrowsMissingIdException() { await GetFullySetCli() - .Command("gsh build create-version") + .Command("mh build create-version") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'create-version'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -83,9 +83,9 @@ public async Task BuildCreateVersion_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -98,9 +98,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build create-version")] + [Category("mh")] + [Category("mh build")] + [Category("mh build create-version")] public async Task BuildCreateVersion_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildDeleteTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildDeleteTests.cs index 9fcdee1..53f974d 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildDeleteTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildDeleteTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildDeleteCommand = "gsh build delete 1"; + const string k_BuildDeleteCommand = "mh build delete 1"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_SucceedsWithValidInput() { await GetFullySetCli() @@ -25,13 +25,13 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_ThrowsMissingBuildIdException() { await GetFullySetCli() - .Command("gsh build delete") + .Command("mh build delete") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'delete'.") .ExecuteAsync(); @@ -39,22 +39,22 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_ThrowsInvalidBuildIdException() { await GetFullySetCli() - .Command("gsh build delete a") + .Command("mh build delete a") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Build ID 'a' not a valid ID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -69,9 +69,9 @@ public async Task BuildDelete_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -84,9 +84,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build delete")] + [Category("mh")] + [Category("mh build")] + [Category("mh build delete")] public async Task BuildDelete_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildGetTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildGetTests.cs index e35bd86..583150c 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildGetTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildGetTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildGetCommand = "gsh build get 1"; + const string k_BuildGetCommand = "mh build get 1"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_SucceedsWithValidInput() { await GetFullySetCli() @@ -30,13 +30,13 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_ThrowsMissingBuildIdException() { await GetFullySetCli() - .Command("gsh build get") + .Command("mh build get") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'get'.") .ExecuteAsync(); @@ -44,22 +44,22 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_ThrowsInvalidBuildIdException() { await GetFullySetCli() - .Command("gsh build get a") + .Command("mh build get a") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Build ID 'a' not a valid ID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -74,9 +74,9 @@ public async Task BuildGet_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -89,9 +89,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build get")] + [Category("mh")] + [Category("mh build")] + [Category("mh build get")] public async Task BuildGet_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildInstallsTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildInstallsTests.cs index 740d9a1..2e9c5b6 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildInstallsTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildInstallsTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildInstallsCommand = "gsh build installs 1"; + const string k_BuildInstallsCommand = "mh build installs 1"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_SucceedsWithValidInput() { await GetFullySetCli() @@ -30,13 +30,13 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_ThrowsMissingBuildIdException() { await GetFullySetCli() - .Command("gsh build installs") + .Command("mh build installs") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'installs'.") .ExecuteAsync(); @@ -44,22 +44,22 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_ThrowsInvalidBuildIdException() { await GetFullySetCli() - .Command("gsh build installs a") + .Command("mh build installs a") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Build ID 'a' not a valid ID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -74,9 +74,9 @@ public async Task BuildInstalls_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -89,9 +89,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build installs")] + [Category("mh")] + [Category("mh build")] + [Category("mh build installs")] public async Task BuildInstalls_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildListTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildListTests.cs index 50d5d68..09a6de4 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildListTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildListTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildListCommand = "gsh build list"; + const string k_BuildListCommand = "mh build list"; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build list")] + [Category("mh")] + [Category("mh build")] + [Category("mh build list")] public async Task BuildList_Succeeds() { await GetFullySetCli() @@ -31,9 +31,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build list")] + [Category("mh")] + [Category("mh build")] + [Category("mh build list")] public async Task BuildList_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -49,9 +49,9 @@ public async Task BuildList_ThrowsNotLoggedInException() [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build list")] + [Category("mh")] + [Category("mh build")] + [Category("mh build list")] public async Task BuildList_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -64,9 +64,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build list")] + [Category("mh")] + [Category("mh build")] + [Category("mh build list")] public async Task BuildList_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildUpdateTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildUpdateTests.cs index b156254..8e299a5 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildUpdateTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingBuildUpdateTests.cs @@ -8,12 +8,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - const string k_BuildUpdateCommand = "gsh build update 1 --name \"Updated Name\""; + const string k_BuildUpdateCommand = "mh build update 1 --name \"Updated Name\""; [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build update")] + [Category("mh")] + [Category("mh build")] + [Category("mh build update")] public async Task BuildUpdate_Succeeds() { await GetFullySetCli() @@ -25,9 +25,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build update")] + [Category("mh")] + [Category("mh build")] + [Category("mh build update")] public async Task BuildUpdate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -43,9 +43,9 @@ public async Task BuildUpdate_ThrowsNotLoggedInException() [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build update")] + [Category("mh")] + [Category("mh build")] + [Category("mh build update")] public async Task BuildUpdate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -58,9 +58,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh build")] - [Category("gsh build update")] + [Category("mh")] + [Category("mh build")] + [Category("mh build update")] public async Task BuildUpdate_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionAvailableTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionAvailableTests.cs index 14a1c05..131a807 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionAvailableTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionAvailableTests.cs @@ -9,12 +9,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - internal const string FleetRegionAvailableCommand = $"gsh fleet-region available {Keys.ValidFleetId}"; + internal const string FleetRegionAvailableCommand = $"mh fleet-region available {Keys.ValidFleetId}"; [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region available")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region available")] public async Task FleetRegionAvailable_SucceedsWithValidInput() { await GetFullySetCli() @@ -23,29 +23,29 @@ await GetFullySetCli() v => { StringAssert.Contains("Fetching available regions...", v); - StringAssert.Contains("name: US East",v); + StringAssert.Contains("name: US East", v); }) .AssertNoErrors() .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region available")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region available")] public async Task FleetRegionAvailable_ThrowsInvalidFleetException() { await GetFullySetCli() - .Command($"gsh fleet-region available A") + .Command($"mh fleet-region available A") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Fleet 'A' not a valid UUID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region available")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region available")] public async Task FleetRegionAvailable_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -60,9 +60,9 @@ public async Task FleetRegionAvailable_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region available")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region available")] public async Task FleetRegionAvailable_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -75,9 +75,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region available")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region available")] public async Task FleetRegionAvailable_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionCreateTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionCreateTests.cs index 77c0ce8..74581ab 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionCreateTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionCreateTests.cs @@ -10,12 +10,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { internal const string FleetRegionCreateCommand = - $"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2"; + $"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2"; [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_SucceedsWithValidInput() { await GetFullySetCli() @@ -24,33 +24,33 @@ await GetFullySetCli() v => { StringAssert.Contains("Creating fleet region...", v); - StringAssert.Contains("fleetRegionId: 00000000-0000-0000-0000-200000000000",v); + StringAssert.Contains("fleetRegionId: 00000000-0000-0000-0000-200000000000", v); }) .AssertNoErrors() .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsMissingFleetException() { await GetFullySetCli() - .Command($"gsh fleet-region create --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2") + .Command($"mh fleet-region create --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--fleet-id' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsMissingRegionException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --min-available-servers 1 --max-servers 2") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --min-available-servers 1 --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--region-id' is required.") .ExecuteAsync(); @@ -58,13 +58,13 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsMissingMinServersException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --max-servers 2") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--min-available-servers' is required.") .ExecuteAsync(); @@ -72,26 +72,26 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsMissingMaxServersException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--max-servers' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsInvalidFleetException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id invalid --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2") + .Command($"mh fleet-region create --fleet-id invalid --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Cannot parse argument 'invalid' for option '--fleet-id'") .ExecuteAsync(); @@ -99,48 +99,48 @@ await GetFullySetCli() [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsInvalidRegionException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id invalid --min-available-servers 1 --max-servers 2") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id invalid --min-available-servers 1 --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Cannot parse argument 'invalid' for option '--region-id'") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsInvalidMinAvailableException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers ABC --max-servers 2") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers ABC --max-servers 2") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Cannot parse argument 'ABC' for option '--min-available-servers'") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsInvalidMaxServersException() { await GetFullySetCli() - .Command($"gsh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers ABC") + .Command($"mh fleet-region create --fleet-id {Keys.ValidFleetId} --region-id {Keys.ValidRegionId} --min-available-servers 1 --max-servers ABC") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Cannot parse argument 'ABC' for option '--max-servers'") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -155,9 +155,9 @@ public async Task FleetRegionCreate_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -170,9 +170,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region create")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region create")] public async Task FleetRegionCreate_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionTemplatesTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionTemplatesTests.cs index 45a1096..f63a6bd 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionTemplatesTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetRegionTemplatesTests.cs @@ -9,12 +9,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - internal const string FleetRegionTemplatesCommand = $"gsh fleet-region templates"; + internal const string FleetRegionTemplatesCommand = $"mh fleet-region templates"; [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region templates")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region templates")] public async Task FleetRegionTemplates_SucceedsWithValidInput() { await GetFullySetCli() @@ -23,16 +23,16 @@ await GetFullySetCli() v => { StringAssert.Contains("Fetching region list...", v); - StringAssert.Contains("name: Example Region",v); + StringAssert.Contains("name: Example Region", v); }) .AssertNoErrors() .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region templates")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region templates")] public async Task FleetRegionTemplates_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -47,9 +47,9 @@ public async Task FleetRegionTemplates_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region templates")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region templates")] public async Task FleetRegionTemplates_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -62,9 +62,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh fleet region")] - [Category("gsh fleet region templates")] + [Category("mh")] + [Category("mh fleet region")] + [Category("mh fleet region templates")] public async Task FleetRegionTemplates_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetTests.cs index 37059df..74be1f0 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingFleetTests.cs @@ -13,12 +13,12 @@ public partial class GameServerHostingTests { static readonly string k_ValidUsageSettingJson = JsonConvert.SerializeObject(Keys.ValidUsageSettingsJson); static readonly string k_FleetCreateCommand = - $"gsh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId} --usage-setting {k_ValidUsageSettingJson}"; + $"mh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId} --usage-setting {k_ValidUsageSettingJson}"; [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -33,9 +33,9 @@ public async Task FleetCreate_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -49,9 +49,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsEnvironmentNameNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -65,69 +65,69 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsBuildConfigurationIdNotSetException() { await GetFullySetCli() - .Command($"gsh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId}") + .Command($"mh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--build-configuration-id' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsRegionIdNotSetException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --os-family linux --build-configuration-id {Keys.ValidBuildConfigurationId}") + $"mh fleet create --name test --os-family linux --build-configuration-id {Keys.ValidBuildConfigurationId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--region-id' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsOsFamilyNotSetException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") + $"mh fleet create --name test --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--os-family' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsNameNotSetException() { await GetFullySetCli() .Command( - $"gsh fleet create --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") + $"mh fleet create --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Option '--name' is required.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsInvalidBuildConfigurationIdException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id invalid") + $"mh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id invalid") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains( "Cannot parse argument 'invalid' for option '--build-configuration-id' as expected type 'System.Int64'.") @@ -135,51 +135,51 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsInvalidRegionIdException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --os-family linux --region-id invalid --build-configuration-id {Keys.ValidBuildConfigurationId}") + $"mh fleet create --name test --os-family linux --region-id invalid --build-configuration-id {Keys.ValidBuildConfigurationId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Region 'invalid' not a valid UUID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsInvalidOsFamilyException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --os-family invalid --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") + $"mh fleet create --name test --os-family invalid --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Invalid option for --os-family.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_ThrowsInvalidUsageSettingsJsonException() { await GetFullySetCli() .Command( - $"gsh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId} --usage-setting invalid_json") + $"mh fleet create --name test --os-family linux --region-id {Keys.ValidTemplateRegionId} --build-configuration-id {Keys.ValidBuildConfigurationId} --usage-setting invalid_json") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Invalid option for --usage-setting") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet create")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet create")] public async Task FleetCreate_SucceedsWithValidInput() { await GetFullySetCli() @@ -189,9 +189,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -199,77 +199,77 @@ public async Task FleetDelete_ThrowsNotLoggedInException() SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await new UgsCliTestCase() - .Command($"gsh fleet delete {Keys.ValidFleetId}") + .Command($"mh fleet delete {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_NotLoggedIn) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await GetLoggedInCli() - .Command($"gsh fleet delete {Keys.ValidFleetId}") + .Command($"mh fleet delete {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_ProjectIdIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_ThrowsEnvironmentNameNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command($"gsh fleet delete {Keys.ValidFleetId}") + .Command($"mh fleet delete {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_EnvironmentNameIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_ThrowsFleetIdNotValidException() { await GetFullySetCli() - .Command("gsh fleet delete invalid-fleet-id") + .Command("mh fleet delete invalid-fleet-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Fleet 'invalid-fleet-id' not a valid UUID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_ThrowsFleetIdNotSetException() { await GetFullySetCli() - .Command("gsh fleet delete") + .Command("mh fleet delete") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'delete'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet delete")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet delete")] public async Task FleetDelete_SucceedsWithValidInput() { await GetFullySetCli() - .Command($"gsh fleet delete {Keys.ValidFleetId}") + .Command($"mh fleet delete {Keys.ValidFleetId}") .AssertExitCode(ExitCode.Success) .AssertStandardOutputContains("Deleting fleet...") .AssertStandardErrorContains("Fleet deleted successfully") @@ -277,9 +277,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -287,86 +287,86 @@ public async Task FleetGet_ThrowsNotLoggedInException() SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await new UgsCliTestCase() - .Command($"gsh fleet get {Keys.ValidFleetId}") + .Command($"mh fleet get {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_NotLoggedIn) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await GetLoggedInCli() - .Command($"gsh fleet get {Keys.ValidFleetId}") + .Command($"mh fleet get {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_ProjectIdIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_ThrowsEnvironmentNameNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command($"gsh fleet get {Keys.ValidFleetId}") + .Command($"mh fleet get {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_EnvironmentNameIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_ThrowsFleetIdNotValidException() { await GetFullySetCli() - .Command("gsh fleet get invalid-fleet-id") + .Command("mh fleet get invalid-fleet-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Fleet 'invalid-fleet-id' not a valid UUID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_ThrowsFleetIdNotSetException() { await GetFullySetCli() - .Command("gsh fleet get") + .Command("mh fleet get") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'get'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet get")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet get")] public async Task FleetGet_SucceedsWithValidInput() { await GetFullySetCli() - .Command($"gsh fleet get {Keys.ValidFleetId}") + .Command($"mh fleet get {Keys.ValidFleetId}") .AssertNoErrors() .AssertStandardOutputContains("name: Test Fleet") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet list")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet list")] public async Task FleetList_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -374,60 +374,60 @@ public async Task FleetList_ThrowsNotLoggedInException() SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await new UgsCliTestCase() - .Command("gsh fleet list") + .Command("mh fleet list") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_NotLoggedIn) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet list")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet list")] public async Task FleetList_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await GetLoggedInCli() - .Command("gsh fleet list") + .Command("mh fleet list") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_ProjectIdIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet list")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet list")] public async Task FleetList_ThrowsEnvironmentNameNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command("gsh fleet list") + .Command("mh fleet list") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_EnvironmentNameIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet list")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet list")] public async Task FleetList_SucceedsWithValidInput() { await GetFullySetCli() - .Command("gsh fleet list") + .Command("mh fleet list") .AssertNoErrors() .AssertStandardOutputContains("Fetching fleet list...") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -435,78 +435,78 @@ public async Task FleetUpdate_ThrowsNotLoggedInException() SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await new UgsCliTestCase() - .Command($"gsh fleet update {Keys.ValidFleetId}") + .Command($"mh fleet update {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_NotLoggedIn) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await GetLoggedInCli() - .Command($"gsh fleet update {Keys.ValidFleetId}") + .Command($"mh fleet update {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_ProjectIdIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsEnvironmentNameNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); await GetLoggedInCli() - .Command($"gsh fleet update {Keys.ValidFleetId}") + .Command($"mh fleet update {Keys.ValidFleetId}") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_EnvironmentNameIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsFleetIdNotValidException() { await GetFullySetCli() - .Command("gsh fleet update invalid-fleet-id") + .Command("mh fleet update invalid-fleet-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Fleet 'invalid-fleet-id' not a valid UUID.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsFleetIdNotSetException() { await GetFullySetCli() - .Command("gsh fleet update") + .Command("mh fleet update") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Required argument missing for command: 'update'.") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_ThrowsInvalidBuildConfigurationIdException() { await GetFullySetCli() - .Command($"gsh fleet update {Keys.ValidFleetId} --build-configurations invalid") + .Command($"mh fleet update {Keys.ValidFleetId} --build-configurations invalid") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains( "Cannot parse argument 'invalid' for option '--build-configurations' as expected type 'System.Int64'.") @@ -514,13 +514,13 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh fleet")] - [Category("gsh fleet update")] + [Category("mh")] + [Category("mh fleet")] + [Category("mh fleet update")] public async Task FleetUpdate_SucceedsWithValidInput() { await GetFullySetCli() - .Command($"gsh fleet update {Keys.ValidFleetId} --name updated") + .Command($"mh fleet update {Keys.ValidFleetId} --name updated --usage-setting {k_ValidUsageSettingJson}") .AssertExitCode(ExitCode.Success) .AssertStandardOutputContains("Updating fleet...") .AssertStandardErrorContains("Fleet updated successfully") diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingMachineListTest.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingMachineListTest.cs index 358d103..8f0d3ad 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingMachineListTest.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingMachineListTest.cs @@ -9,12 +9,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_MachineListCommand = $"gsh machine list"; + static readonly string k_MachineListCommand = $"mh machine list"; [Test] - [Category("gsh")] - [Category("gsh machine")] - [Category("gsh machine list")] + [Category("mh")] + [Category("mh machine")] + [Category("mh machine list")] [Ignore("Failing with feature flag")] public async Task MachineList_Succeeds() { @@ -33,9 +33,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh machine")] - [Category("gsh machine list")] + [Category("mh")] + [Category("mh machine")] + [Category("mh machine list")] [Ignore("Failing with feature flag")] public async Task MachineList_ThrowsNotLoggedInException() { @@ -51,9 +51,9 @@ public async Task MachineList_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh machine")] - [Category("gsh machine list")] + [Category("mh")] + [Category("mh machine")] + [Category("mh machine list")] [Ignore("Failing with feature flag")] public async Task MachineList_ThrowsProjectIdNotSetException() { @@ -67,9 +67,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh machine")] - [Category("gsh machine list")] + [Category("mh")] + [Category("mh machine")] + [Category("mh machine list")] [Ignore("Failing with feature flag")] public async Task MachineList_ThrowsEnvironmentIdNotSetException() { diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFileDownloadTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFileDownloadTests.cs index 23720c8..91f0ae3 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFileDownloadTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFileDownloadTests.cs @@ -16,12 +16,12 @@ public partial class GameServerHostingTests static string tempDirectory = Path.GetTempPath(); static string outputArgPath = $"{tempDirectory}/server.log"; - static readonly string k_ServerFilesDownloadCommand = $"gsh server files download --server-id {Keys.ValidServerId} --path {Keys.ValidErrorLogPath} --output {outputArgPath}"; + static readonly string k_ServerFilesDownloadCommand = $"mh server files download --server-id {Keys.ValidServerId} --path {Keys.ValidErrorLogPath} --output {outputArgPath}"; [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files download")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files download")] public async Task ServerFilesDownload_Succeeds() { await GetFullySetCli() @@ -43,9 +43,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files download")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files download")] public async Task ServerFilesDownload_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -60,9 +60,9 @@ public async Task ServerFilesDownload_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files download")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files download")] public async Task ServerFilesDownload_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -75,9 +75,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files download")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files download")] public async Task ServerFilesDownload_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFilesTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFilesTests.cs index cdb8ed8..3dd949a 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFilesTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerFilesTests.cs @@ -9,13 +9,13 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files")] public async Task ServerFiles_Succeeds() { await GetFullySetCli() - .Command("gsh server files list --server-id 123") + .Command("mh server files list --server-id 123") .AssertStandardOutput( str => { @@ -27,9 +27,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files")] public async Task ServerFiles_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -37,36 +37,36 @@ public async Task ServerFiles_ThrowsNotLoggedInException() SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await new UgsCliTestCase() - .Command("gsh server files list --server-id 123") + .Command("mh server files list --server-id 123") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_NotLoggedIn) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files")] public async Task ServerFiles_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); SetConfigValue("environment-name", CommonKeys.ValidEnvironmentName); await GetLoggedInCli() - .Command("gsh server files list --server-id 123") + .Command("mh server files list --server-id 123") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_ProjectIdIsNotSet) .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server files")] + [Category("mh")] + [Category("mh server")] + [Category("mh server files")] public async Task ServerFiles_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command("gsh server files list --server-id 123") + .Command("mh server files list --server-id 123") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains(k_EnvironmentNameIsNotSet) .ExecuteAsync(); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerGetTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerGetTests.cs index 2f8e776..adb6517 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerGetTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerGetTests.cs @@ -9,12 +9,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_ServersGetCommand = $"gsh server get {Keys.ValidServerId}"; + static readonly string k_ServersGetCommand = $"mh server get {Keys.ValidServerId}"; [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_SucceedsWithValidInput() { await GetFullySetCli() @@ -24,9 +24,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_Succeeds() { await GetFullySetCli() @@ -43,9 +43,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -60,9 +60,9 @@ public async Task ServerGet_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -76,9 +76,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -90,14 +90,14 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server get")] + [Category("mh")] + [Category("mh server")] + [Category("mh server get")] public async Task ServerGet_ThrowsServerIdNotValidException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command("gsh server get invalid-server-id") + .Command("mh server get invalid-server-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Server ID 'invalid-server-id' not a valid ID") .ExecuteAsync(); diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerListTest.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerListTest.cs index 3565a89..f335a95 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerListTest.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/GameServerHostingTests/GameServerHostingServerListTest.cs @@ -9,12 +9,12 @@ namespace Unity.Services.Cli.IntegrationTest.GameServerHostingTests; public partial class GameServerHostingTests { - static readonly string k_ServerListCommand = $"gsh server list --fleet-id {Keys.ValidFleetId}"; + static readonly string k_ServerListCommand = $"mh server list --fleet-id {Keys.ValidFleetId}"; [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_SucceedsWithValidInput() { await GetFullySetCli() @@ -24,9 +24,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_Succeeds() { await GetFullySetCli() @@ -43,9 +43,9 @@ await GetFullySetCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_ThrowsNotLoggedInException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -60,9 +60,9 @@ public async Task ServerList_ThrowsNotLoggedInException() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_ThrowsProjectIdNotSetException() { SetConfigValue("environment-id", CommonKeys.ValidEnvironmentId); @@ -76,9 +76,9 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_ThrowsEnvironmentIdNotSetException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); @@ -90,29 +90,29 @@ await GetLoggedInCli() } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_ThrowsFleetIdNotValidException() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() - .Command("gsh server list --fleet-id invalid-fleet-id") + .Command("mh server list --fleet-id invalid-fleet-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains("Invalid option for --fleet-id. invalid-fleet-id is not a valid UUID") .ExecuteAsync(); } [Test] - [Category("gsh")] - [Category("gsh server")] - [Category("gsh server list")] + [Category("mh")] + [Category("mh server")] + [Category("mh server list")] public async Task ServerList_ThrowsBuildConfigurationIdNotValid() { SetConfigValue("project-id", CommonKeys.ValidProjectId); await GetLoggedInCli() .Command( - $"gsh server list --fleet-id {Keys.ValidFleetId} --build-configuration-id invalid-build-configuration-id") + $"mh server list --fleet-id {Keys.ValidFleetId} --build-configuration-id invalid-build-configuration-id") .AssertExitCode(ExitCode.HandledError) .AssertStandardErrorContains( "Invalid option for --build-configuration-id. invalid-build-configuration-id is not a valid number.") diff --git a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/LobbyTests/LobbyTests.cs b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/LobbyTests/LobbyTests.cs index 7ebeeb6..65d5175 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/LobbyTests/LobbyTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/LobbyTests/LobbyTests.cs @@ -23,6 +23,8 @@ public class LobbyTests : UgsCliFixture const string k_LobbyId = "test-lobby-id"; const string k_PlayerId = "test-player-id"; const string k_ConfigId = "test-config-id"; + const string k_ConfigNonJsonInput = "invalidJson"; + const string k_ConfigInvalidInput = "{}"; const string k_RequiredArgumentMissing = "Required argument missing for command:"; const string k_FailedToDeserialize = "Failed to deserialize object for Lobby request."; @@ -584,13 +586,23 @@ await AuthenticatedCommand() .ExecuteAsync(); } + [Test] + public async Task UpdateConfig_ThrowsIfRequestBodyIsNonJson() + { + await AuthenticatedCommand() + .Command($"lobby config update {k_ConfigId} {k_ConfigNonJsonInput}") + .AssertExitCode(ExitCode.HandledError) + .AssertStandardErrorContains("The configuration input value is invalid") + .ExecuteAsync(); + } + [Test] public async Task UpdateConfig_ThrowsIfRequestBodyIsInvalid() { await AuthenticatedCommand() - .Command($"lobby config update {k_ConfigId} ''") + .Command($"lobby config update {k_ConfigId} {k_ConfigInvalidInput}") .AssertExitCode(ExitCode.HandledError) - .AssertStandardErrorContains("Empty config request body") + .AssertStandardErrorContains("There is no configuration in input value") .ExecuteAsync(); } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ConfigUpdateHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ConfigUpdateHandlerTests.cs index dfb93d5..5794cf9 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ConfigUpdateHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ConfigUpdateHandlerTests.cs @@ -17,6 +17,7 @@ class ConfigUpdateHandlerTests [SetUp] public void SetUp() { + m_MockLogger.Reset(); m_MockRemoteConfig = new(); m_MockRemoteConfig.Setup(l => l.UpdateConfigAsync( @@ -25,6 +26,13 @@ public void SetUp() It.IsAny(), CancellationToken.None)) .Returns(Task.CompletedTask); + m_MockRemoteConfig.Setup(l => + l.ApplySchemaAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + CancellationToken.None)) + .Returns(Task.CompletedTask); } [Test] @@ -33,7 +41,19 @@ public void ConfigUpdateHandler_HandlesInputAndLogsOnSuccess() var input = new LobbyConfigUpdateInput() { CloudProjectId = "projectid", - JsonFileOrBody = "{}", + JsonFileOrBody = """{"type":"lobby","value":[{"key":"lobbyConfig","type":"json","schemaId":"lobby","value":{"socialProfilesEnabled":false,"activeLifespanSeconds":30,"disconnectRemovalTimeSeconds":110,"playerSlots":{"minimum":1,"maximum":100}}}]}""", + }; + Assert.DoesNotThrowAsync(async () => await ConfigUpdateHandler.ConfigUpdateAsync(input, m_MockRemoteConfig.Object, m_MockLogger.Object, default)); + TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, null, Times.Once); + } + + [Test] + public void ConfigUpdateHandler_HandlesV2InputAndLogsOnSuccess() + { + var input = new LobbyConfigUpdateInput() + { + CloudProjectId = "projectid", + JsonFileOrBody = """{"type":"lobby","value":[{"key":"lobbyConfig","type":"json","schemaId":"lobbyv2","value":{"socialProfilesEnabled":false,"activeLifespanSeconds":30,"disconnectRemovalTimeSeconds":110,"disconnectHostMigrationTimeSeconds":10,"playerSlots":{"minimum":1,"maximum":100}}}]}""", }; Assert.DoesNotThrowAsync(async () => await ConfigUpdateHandler.ConfigUpdateAsync(input, m_MockRemoteConfig.Object, m_MockLogger.Object, default)); TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Information, null, Times.Once); @@ -45,5 +65,17 @@ public void ConfigUpdateHandler_MissingProjectIdThrowsException() var input = new LobbyConfigUpdateInput(); Assert.ThrowsAsync(async () => await ConfigUpdateHandler.ConfigUpdateAsync(input, m_MockRemoteConfig.Object, m_MockLogger.Object, default)); } + + [Test] + public void ConfigUpdateHandler_MalformedConfigurationThrowsException() + { + var input = new LobbyConfigUpdateInput() + { + CloudProjectId = "projectid", + JsonFileOrBody = "{}", + }; + Assert.ThrowsAsync(async () => await ConfigUpdateHandler.ConfigUpdateAsync(input, m_MockRemoteConfig.Object, m_MockLogger.Object, default)); + } + } } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ExportHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ExportHandlerTests.cs index 2c75184..bdfe40f 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ExportHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ExportHandlerTests.cs @@ -13,6 +13,7 @@ using Unity.Services.Cli.Lobby.Handlers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Unity.Services.Cli.Lobby.Handlers.Config; namespace Unity.Services.Cli.Lobby.UnitTest.Handlers; @@ -55,13 +56,14 @@ public void SetUp() { return JsonConvert.SerializeObject(new RemoteConfigResponse { - Configs = new List{ - new RemoteConfigResponse.Config{ + Configs = new List{ + new RemoteConfigValue{ Id = m_Config.Id, Type = LobbyConstants.ConfigType, - Value = new List{ - new RemoteConfigResponse.ConfigValue{ + Value = new List{ + new LobbyConfigValue{ Key = LobbyConstants.ConfigKey, + SchemaId = LobbyConstants.SchemaId, Value = configElement, } }, diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ImportHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ImportHandlerTests.cs index 4df0899..a0e9fba 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ImportHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/ImportHandlerTests.cs @@ -10,6 +10,7 @@ using Unity.Services.Cli.Authoring.Import.Input; using Unity.Services.Cli.RemoteConfig.Service; using Unity.Services.Cli.Lobby.Handlers; +using Unity.Services.Cli.Lobby.Handlers.Config; using Unity.Services.Cli.Lobby.Handlers.ImportExport; using Unity.Services.Cli.RemoteConfig.Types; @@ -25,9 +26,13 @@ class ImportHandlerTests readonly Mock m_MockLoadingIndicator = new(); LobbyConfig m_Config = null!; + LobbyConfig m_ConfigV1 = null!; + LobbyConfig m_ConfigV2 = null!; LobbyImporter m_LobbyImporter = null!; + const string k_V1Schema = ".*resource:/lobby.*"; + const string k_V2Schema = ".*resource:/lobbyv2.*"; [SetUp] public void SetUp() @@ -35,6 +40,12 @@ public void SetUp() m_Config = JsonConvert.DeserializeObject( "{ \"Id\": \"mock_id\", \"Config\": { \"mock_key\": \"mock_value\" } }" )!; + m_ConfigV1 = JsonConvert.DeserializeObject( + "{ \"Id\": \"mock_id\", \"SchemaId\": \"lobby\", \"Config\": { \"mock_key\": \"mock_value\" } }" + )!; + m_ConfigV2 = JsonConvert.DeserializeObject( + "{ \"Id\": \"mock_id\", \"SchemaId\": \"lobbyv2\", \"Config\": { \"mock_key\": \"mock_value\" } }" + )!; m_MockUnityEnvironment.Reset(); m_MockRemoteConfigService.Reset(); @@ -43,14 +54,6 @@ public void SetUp() m_MockLogger.Reset(); - m_MockArchiver.Reset(); - m_MockArchiver.Setup( - za => za.UnzipAsync( - It.IsAny(), - It.IsAny(), - It.IsAny())) - .Returns(Task.FromResult>(new List { m_Config })); - m_LobbyImporter = new LobbyImporter( m_MockRemoteConfigService.Object, m_MockArchiver.Object, @@ -172,63 +175,87 @@ public async Task ConfigExists_Updates() InputDirectory = "mock_input_directory", }; - SetupExistingConfig(m_Config); + foreach (var tc in new List<(LobbyConfig config, string regex)> + { + (m_Config, k_V1Schema), + (m_ConfigV1, k_V1Schema), + (m_ConfigV2, k_V2Schema), + }) + { + SetupExistingConfig(tc.config); - await m_LobbyImporter.ImportAsync(importInput, CancellationToken.None); + await m_LobbyImporter.ImportAsync(importInput, CancellationToken.None); - m_MockRemoteConfigService.Verify( - rcs => rcs.UpdateConfigAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny()), - Times.Once); - m_MockRemoteConfigService.Verify( - rcs => rcs.CreateConfigAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny()), - Times.Never); + m_MockRemoteConfigService.Verify( + rcs => rcs.UpdateConfigAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Once); + m_MockRemoteConfigService.Verify( + rcs => rcs.ApplySchemaAsync( + It.IsAny(), + It.IsAny(), + It.IsRegex(tc.regex), + It.IsAny()), + Times.Once); + m_MockRemoteConfigService.Verify( + rcs => rcs.CreateConfigAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny()), + Times.Never); + } } [Test] public async Task ConfigDoesNotExist_CreatesAndAppliesSchema() { - m_Config = new(); - - var importInput = new ImportInput() + foreach (var tc in new List<(LobbyConfig config, string regex)> + { + (m_Config, k_V1Schema), + (m_ConfigV1, k_V1Schema), + (m_ConfigV2, k_V2Schema), + }) { - InputDirectory = "mock_input_directory", - }; + SetupNonExistingConfig(tc.config); - await m_LobbyImporter.ImportAsync(importInput, CancellationToken.None); + var importInput = new ImportInput() + { + InputDirectory = "mock_input_directory", + }; - m_MockRemoteConfigService.Verify( - rcs => rcs.CreateConfigAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny()), - Times.Once); - m_MockRemoteConfigService.Verify( - rcs => rcs.ApplySchemaAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny()), - Times.Once); - m_MockRemoteConfigService.Verify( - rcs => rcs.UpdateConfigAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny()), - Times.Once); + await m_LobbyImporter.ImportAsync(importInput, CancellationToken.None); + + m_MockRemoteConfigService.Verify( + rcs => rcs.CreateConfigAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny()), + Times.Once); + m_MockRemoteConfigService.Verify( + rcs => rcs.ApplySchemaAsync( + It.IsAny(), + It.IsAny(), + It.IsRegex(tc.regex), + It.IsAny()), + Times.Once); + m_MockRemoteConfigService.Verify( + rcs => rcs.UpdateConfigAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Once); + } } + [Test] public async Task Reconcile_Updates() { @@ -259,8 +286,36 @@ public async Task Reconcile_Updates() Times.Once); } + void SetupConfigFile(LobbyConfig config) + { + m_MockArchiver.Reset(); + m_MockArchiver.Setup( + za => za.UnzipAsync( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Returns(Task.FromResult>(new List { config })); + } + + void SetupNonExistingConfig(LobbyConfig config) + { + SetupConfigFile(config); + m_MockRemoteConfigService.Reset(); + m_MockRemoteConfigService.Setup( + rc => rc.GetAllConfigsFromEnvironmentAsync(It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(() => + { + return JsonConvert.SerializeObject(new RemoteConfigResponse()); + }); + + } void SetupExistingConfig(LobbyConfig config) { + SetupConfigFile(config); + m_MockRemoteConfigService.Reset(); m_MockRemoteConfigService.Setup( rc => rc.GetAllConfigsFromEnvironmentAsync(It.IsAny(), It.IsAny(), @@ -270,13 +325,14 @@ void SetupExistingConfig(LobbyConfig config) { return JsonConvert.SerializeObject(new RemoteConfigResponse { - Configs = new List{ - new RemoteConfigResponse.Config{ + Configs = new List{ + new RemoteConfigValue{ Id = config.Id, Type = LobbyConstants.ConfigType, - Value = new List{ - new RemoteConfigResponse.ConfigValue{ + Value = new List{ + new LobbyConfigValue{ Key = LobbyConstants.ConfigKey, + SchemaId = config.SchemaId, Value = config.Config, } }, diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/LobbyConfigTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/LobbyConfigTests.cs index 92f8ddc..0a9be2c 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/LobbyConfigTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby.UnitTest/Handlers/LobbyConfigTests.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json.Serialization; using NUnit.Framework; using Unity.Services.Cli.Lobby.Handlers; -using Unity.Services.Cli.Lobby.Handlers.ImportExport; +using Unity.Services.Cli.Lobby.Handlers.Config; namespace Unity.Services.Cli.Lobby.UnitTest.Handlers; @@ -62,7 +62,7 @@ public void TryParse_FailsWithNoLobbyConfigValue() [Test] public void TryParse_FailsWithNoConfigs() { - var configResponse = new List(); + var configResponse = new List(); var json = JsonConvert.SerializeObject( configResponse, new JsonSerializerSettings @@ -81,7 +81,7 @@ static RemoteConfigResponse NewDefaultConfig(bool includeMockConfig = true) new MockLobbyConfig(k_DefaultStringSetting, k_DefaultIntSetting)) : "{}"; var now = DateTime.Now.ToString(k_TimestampFormat); - var config = new RemoteConfigResponse.Config + var config = new RemoteConfigValue { ProjectId = Guid.NewGuid().ToString(), EnvironmentId = Guid.NewGuid().ToString(), @@ -89,9 +89,9 @@ static RemoteConfigResponse NewDefaultConfig(bool includeMockConfig = true) Type = LobbyConstants.ConfigType, CreatedAt = now, UpdatedAt = now, - Value = new List + Value = new List { - new RemoteConfigResponse.ConfigValue{ + new LobbyConfigValue{ Key = LobbyConstants.ConfigKey, Type = RemoteConfig.Types.ValueType.Json.ToString().ToLower(), SchemaId = LobbyConstants.ConfigType, @@ -102,7 +102,7 @@ static RemoteConfigResponse NewDefaultConfig(bool includeMockConfig = true) return new RemoteConfigResponse { - Configs = new List + Configs = new List { config } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchemaV2.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchemaV2.cs new file mode 100644 index 0000000..af11a7d --- /dev/null +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchemaV2.cs @@ -0,0 +1,15 @@ +using System.Reflection; +using Unity.Services.Cli.Authoring.Templates; +using Unity.Services.Cli.Common.Utils; + +namespace Unity.Services.Cli.Lobby.Handlers.Config; + +public class ConfigSchemaV2 : IFileTemplate +{ + const string k_EmbeddedConfigSchema = "Unity.Services.Cli.Lobby.Handlers.Config.lobby-config-schema-v2.json"; + + public string Extension => ".json"; + + public string FileBodyText => ResourceFileHelper + .ReadResourceFileAsync(Assembly.GetExecutingAssembly(), k_EmbeddedConfigSchema).Result; +} diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/LobbyConfig.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/LobbyConfig.cs new file mode 100644 index 0000000..1da6093 --- /dev/null +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/LobbyConfig.cs @@ -0,0 +1,138 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Unity.Services.Cli.Common.Exceptions; + +namespace Unity.Services.Cli.Lobby.Handlers.Config; + +public class LobbyConfig +{ + public string Id { get; set; } + + public string SchemaId { get; set; } + + public JObject Config { get; set; } + + public LobbyConfig() + { + Id = ""; + SchemaId = ""; + Config = new JObject(); + } + + public static LobbyConfig Parse(string response) + { + if (string.IsNullOrWhiteSpace(response)) + { + throw new ArgumentNullException(nameof(response)); + } + + var configResponse = JsonConvert.DeserializeObject(response); + if (configResponse.Configs == null || configResponse.Configs.Count == 0) + { + throw new CliException( + $"There is no lobby configuration available in this environment.", + ExitCode.HandledError); + } + + var lobbyConfig = configResponse.Configs.First(c => c.Type == LobbyConstants.ConfigType); + var lobbyConfigValue = lobbyConfig.Value.First(c => c.Key == LobbyConstants.ConfigKey); + + var lobbyConfigData = lobbyConfigValue.Value; + if (lobbyConfigData == null || lobbyConfigData.Count == 0) + { + throw new CliException( + $"There is no lobby configuration available in this environment.", + ExitCode.HandledError); + } + + return new LobbyConfig + { + Id = lobbyConfig.Id, + SchemaId = lobbyConfigValue.SchemaId, + Config = lobbyConfigData + }; + } + + public static LobbyConfigValue ParseValue(string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentNullException(nameof(value)); + } + + UpdateConfigRequest updateConfigRequest; + try + { + updateConfigRequest = JsonConvert.DeserializeObject(value); + if (updateConfigRequest.Type == null || updateConfigRequest.Value.Count == 0) + { + throw new CliException( + $"There is no configuration in input value.", + ExitCode.HandledError); + } + } + catch (JsonReaderException) + { + throw new CliException( + $"The configuration input value is invalid.", + ExitCode.HandledError); + } + + var lobbyConfigValue = updateConfigRequest.Value.First(c => c.Key == LobbyConstants.ConfigKey); + + var lobbyConfigData = lobbyConfigValue.Value; + if (lobbyConfigData == null || lobbyConfigData.Count == 0) + { + throw new CliException( + $"There is no lobby configuration in input value.", + ExitCode.HandledError); + } + + return lobbyConfigValue; + } + + public static bool TryParse(string response, out LobbyConfig? config) + { + try + { + config = Parse(response); + return true; + } + catch + { + config = null; + return false; + } + } +} + +public struct RemoteConfigResponse +{ + public List Configs { get; set; } +} + +public struct UpdateConfigRequest +{ + public string Type { get; set; } + public List Value { get; set; } +} +public struct RemoteConfigValue +{ + public string ProjectId { get; set; } + public string EnvironmentId { get; set; } + public string Type { get; set; } + public string Id { get; set; } + public string Version { get; set; } + public string CreatedAt { get; set; } + public string UpdatedAt { get; set; } + + public List Value { get; set; } +} + +public struct LobbyConfigValue +{ + public string Key { get; set; } + public string Type { get; set; } + public string SchemaId { get; set; } + public JObject Value { get; set; } +} diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema-v2.json b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema-v2.json new file mode 100644 index 0000000..3e72d88 --- /dev/null +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema-v2.json @@ -0,0 +1,74 @@ +{ + "title": "Lobby Project Config", + "$id": "resource:/lobbyv2", + "description": "The schema for a Lobby project's configuration.", + "type": "object", + "properties": { + "activeLifespanSeconds": { + "$ref": "#/definitions/activeLifespanSeconds", + "description": "The minimum amount of time, in seconds, that must pass before a lobby is considered inactive." + }, + "disconnectRemovalTimeSeconds": { + "$ref": "#/definitions/disconnectRemovalTimeSeconds", + "description": "The minimum amount of time, in seconds, that must pass before a disconnected player is removed from the lobby." + }, + "disconnectHostMigrationTimeSeconds": { + "$ref": "#/definitions/disconnectHostMigrationTimeSeconds", + "description": "The minimum amount of time, in seconds, that must pass before a disconnected host loses host status and triggers a host migration." + }, + "playerSlots": { + "$ref": "#/definitions/playerSlots", + "description": "The minimum and maximum allowed values for a lobby's 'MaxPlayers' property." + }, + "socialProfilesEnabled": { + "type": "boolean", + "description": "Whether or not to inject profiles from Social Profile data in lobby responses." + } + }, + "required": [ + "activeLifespanSeconds", + "disconnectRemovalTimeSeconds", + "disconnectHostMigrationTimeSeconds", + "playerSlots" + ], + "definitions": { + "playerSlots": { + "$id": "#playerSlots", + "type": "object", + "properties": { + "minimum": { + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "maximum": { + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, + "required": [ + "minimum", + "maximum" + ] + }, + "activeLifespanSeconds": { + "$id": "#activeLifespanSeconds", + "type": "integer", + "minimum": 10, + "maximum": 3600 + }, + "disconnectRemovalTimeSeconds": { + "$id": "#disconnectRemovalTimeSeconds", + "type": "integer", + "minimum": 10, + "maximum": 3600 + }, + "disconnectHostMigrationTimeSeconds": { + "$id": "#disconnectHostMigrationTimeSeconds", + "type": "integer", + "minimum": 5, + "maximum": 3600 + } + } +} diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema.json b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema.json index ecc1295..efebfbd 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema.json +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/lobby-config-schema.json @@ -5,20 +5,30 @@ "type": "object", "properties": { "activeLifespanSeconds": { - "type": "integer", - "minimum": 10, - "maximum": 3600, - "description": - "The minimum amount of time, in seconds, that must pass before a lobby is considered inactive." + "$ref": "#/definitions/activeLifespanSeconds", + "description": "The minimum amount of time, in seconds, that must pass before a lobby is considered inactive." }, "disconnectRemovalTimeSeconds": { - "type": "integer", - "minimum": 10, - "maximum": 3600, - "description": - "The minimum amount of time, in seconds, that must pass before a disconnected player is removed from the lobby." + "$ref": "#/definitions/disconnectRemovalTimeSeconds", + "description": "The minimum amount of time, in seconds, that must pass before a disconnected player is removed from the lobby." + }, + "playerSlots": { + "$ref": "#/definitions/playerSlots", + "description": "The minimum and maximum allowed values for a lobby's 'MaxPlayers' property." }, + "socialProfilesEnabled": { + "type": "boolean", + "description": "Whether or not to inject profiles from Social Profile data in lobby responses." + } + }, + "required": [ + "activeLifespanSeconds", + "disconnectRemovalTimeSeconds", + "playerSlots" + ], + "definitions": { "playerSlots": { + "$id": "#playerSlots", "type": "object", "properties": { "minimum": { @@ -32,14 +42,22 @@ "maximum": 100 } }, - "required": ["minimum", "maximum"], - "description": "The minimum and maximum allowed values for a lobby's \"MaxPlayers\" property." + "required": [ + "minimum", + "maximum" + ] }, - "socialProfilesEnabled": { - "type": "boolean", - "description": "Whether or not to inject profiles from Social Profile data in lobby responses.", - "default": false + "activeLifespanSeconds": { + "$id": "#activeLifespanSeconds", + "type": "integer", + "minimum": 10, + "maximum": 3600 + }, + "disconnectRemovalTimeSeconds": { + "$id": "#disconnectRemovalTimeSeconds", + "type": "integer", + "minimum": 10, + "maximum": 3600 } - }, - "required": ["activeLifespanSeconds", "disconnectRemovalTimeSeconds", "playerSlots"] + } } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ConfigUpdateHandler.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ConfigUpdateHandler.cs index 08e7a09..8930a15 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ConfigUpdateHandler.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ConfigUpdateHandler.cs @@ -1,7 +1,9 @@ using Microsoft.Extensions.Logging; using Unity.Services.Cli.Common.Exceptions; using Unity.Services.Cli.Common.Models; +using Unity.Services.Cli.Lobby.Handlers.Config; using Unity.Services.Cli.Lobby.Input; +using Unity.Services.Cli.RemoteConfig.Exceptions; using Unity.Services.Cli.RemoteConfig.Service; namespace Unity.Services.Cli.Lobby.Handlers @@ -25,10 +27,28 @@ public static async Task ConfigUpdateAsync(LobbyConfigUpdateInput input, IRemote var projectId = input.CloudProjectId ?? throw new MissingConfigurationException( Keys.ConfigKeys.ProjectId, Keys.EnvironmentKeys.ProjectId); + var body = RequestBodyHandler.GetRequestBodyFromFileOrInput(input.JsonFileOrBody!, isRequired: true); + + var lobbyConfig = LobbyConfig.ParseValue(body); + + var configSchema = new ConfigSchema().FileBodyText; + if (lobbyConfig.SchemaId == LobbyConstants.SchemaIdV2) + { + configSchema = new ConfigSchemaV2().FileBodyText; + } + try + { + await service.ApplySchemaAsync(projectId, input.ConfigId!, configSchema, cancellationToken); + } + catch (ApiException) // Because it's an internal API, we hide any schema-related HTTP exceptions from the user. + { + throw new CliException("An error occurred while updating the Lobby configuration.", ExitCode.HandledError); + } + await service.UpdateConfigAsync( projectId, input.ConfigId!, - RequestBodyHandler.GetRequestBodyFromFileOrInput(input.JsonFileOrBody!, isRequired: true), + body, cancellationToken); logger.LogInformation("Config successfully updated."); } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyConfig.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyConfig.cs deleted file mode 100644 index f5f41ee..0000000 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyConfig.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Unity.Services.Cli.Common.Exceptions; - -namespace Unity.Services.Cli.Lobby.Handlers.ImportExport; - -public class LobbyConfig -{ - public string Id { get; set; } - - public JObject Config { get; set; } - - public LobbyConfig() - { - Id = ""; - Config = new JObject(); - } - - public static LobbyConfig Parse(string response) - { - if (string.IsNullOrWhiteSpace(response)) - { - throw new ArgumentNullException(nameof(response)); - } - - var configResponse = JsonConvert.DeserializeObject(response); - if (configResponse.Configs == null || configResponse.Configs.Count == 0) - { - throw new CliException($"There is no lobby configuration available in this environment.", ExitCode.HandledError); - } - - var lobbyConfig = configResponse.Configs.First(c => c.Type == LobbyConstants.ConfigType); - var lobbyConfigValue = lobbyConfig.Value.First(c => c.Key == LobbyConstants.ConfigKey); - - var lobbyConfigData = lobbyConfigValue.Value; - if (lobbyConfigData == null || lobbyConfigData.Count == 0) - { - throw new CliException($"There is no lobby configuration available in this environment.", ExitCode.HandledError); - } - - return new LobbyConfig - { - Id = lobbyConfig.Id, - Config = lobbyConfigData - }; - } - - public static bool TryParse(string response, out LobbyConfig? config) - { - try - { - config = Parse(response); - return true; - } - catch - { - config = null; - return false; - } - } -} - - -public struct RemoteConfigResponse -{ - public List Configs { get; set; } - - public struct Config - { - public string ProjectId { get; set; } - public string EnvironmentId { get; set; } - public string Type { get; set; } - public string Id { get; set; } - public string Version { get; set; } - public string CreatedAt { get; set; } - public string UpdatedAt { get; set; } - - public List Value { get; set; } - } - - public struct ConfigValue - { - public string Key { get; set; } - public string Type { get; set; } - public string SchemaId { get; set; } - public JObject Value { get; set; } - } -} diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyExporter.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyExporter.cs index 2c05c76..0206343 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyExporter.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyExporter.cs @@ -4,6 +4,7 @@ using Unity.Services.Cli.Authoring.Compression; using Unity.Services.Cli.Authoring.Export; using Unity.Services.Cli.Authoring.Model; +using Unity.Services.Cli.Lobby.Handlers.Config; using Unity.Services.Cli.RemoteConfig.Service; namespace Unity.Services.Cli.Lobby.Handlers.ImportExport; diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyImporter.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyImporter.cs index 5af9f17..bff3035 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyImporter.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/LobbyImporter.cs @@ -8,10 +8,10 @@ using Newtonsoft.Json.Serialization; using Unity.Services.Cli.Authoring.Model; using Unity.Services.Cli.Authoring.Templates; -using Unity.Services.Cli.RemoteConfig.Model; using Unity.Services.Cli.Common.Exceptions; using Unity.Services.Cli.Lobby.Handlers.Config; using Unity.Services.Cli.RemoteConfig.Exceptions; +using UpdateConfigRequest = Unity.Services.Cli.RemoteConfig.Model.UpdateConfigRequest; namespace Unity.Services.Cli.Lobby.Handlers.ImportExport; @@ -19,6 +19,7 @@ class LobbyImporter : BaseImporter { readonly IRemoteConfigService m_RemoteConfigService; readonly IFileTemplate m_ConfigSchema; + readonly IFileTemplate m_ConfigSchemaV2; public LobbyImporter( IRemoteConfigService remoteConfigService, @@ -32,6 +33,7 @@ public LobbyImporter( { m_RemoteConfigService = remoteConfigService; m_ConfigSchema = new ConfigSchema(); + m_ConfigSchemaV2 = new ConfigSchemaV2(); } protected override string FileName => LobbyConstants.ZipName; @@ -58,20 +60,25 @@ protected override async Task CreateConfigAsync( protected override async Task UpdateConfigAsync(string projectId, string environmentId, LobbyConfig config, CancellationToken cancellationToken) { string configId = config.Id; + string schemaId = config.SchemaId; + if (string.IsNullOrEmpty(schemaId)) + { + schemaId = LobbyConstants.SchemaId; + } // Configs should already have the schema applied, but we do this as a safeguard because if they don't, the // subsequent update request will fail. - await ApplySchema(projectId, configId, cancellationToken); + await ApplySchema(projectId, configId, schemaId, cancellationToken); UpdateConfigRequest request = new UpdateConfigRequest { Type = LobbyConstants.ConfigType, Value = new object[] { - new RemoteConfigResponse.ConfigValue + new LobbyConfigValue { Key = LobbyConstants.ConfigKey, Type = RemoteConfig.Types.ValueType.Json.ToString().ToLower(), - SchemaId = LobbyConstants.SchemaId, + SchemaId = schemaId, Value = config.Config } } @@ -150,11 +157,17 @@ protected override ImportState CreateState(IEnumerable return new ImportState(toCreate, toUpdate, toDelete); } - async Task ApplySchema(string projectId, string configId, CancellationToken cancellationToken) + async Task ApplySchema(string projectId, string configId, string schemaId, CancellationToken cancellationToken) { + var configSchemaFileBodyText = m_ConfigSchema.FileBodyText; + if (LobbyConstants.SchemaIdV2 == schemaId) + { + configSchemaFileBodyText = m_ConfigSchemaV2.FileBodyText; + } + try { - await m_RemoteConfigService.ApplySchemaAsync(projectId, configId, m_ConfigSchema.FileBodyText, cancellationToken); + await m_RemoteConfigService.ApplySchemaAsync(projectId, configId, configSchemaFileBodyText, cancellationToken); } catch (ApiException) // Because it's an internal API, we hide any schema-related HTTP exceptions from the user. { diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/LobbyConstants.cs b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/LobbyConstants.cs index ae1dab6..230e790 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/LobbyConstants.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/LobbyConstants.cs @@ -6,6 +6,8 @@ static class LobbyConstants internal const string SchemaId = "lobby"; + internal const string SchemaIdV2 = "lobbyv2"; + internal const string ConfigKey = "lobbyConfig"; internal const string ZipName = "ugs.lozip"; diff --git a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Unity.Services.Cli.Lobby.csproj b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Unity.Services.Cli.Lobby.csproj index 9598bb9..9cc5608 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Lobby/Unity.Services.Cli.Lobby.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli.Lobby/Unity.Services.Cli.Lobby.csproj @@ -28,6 +28,7 @@ $(DefineConstants);$(ExtraDefineConstants) + \ No newline at end of file diff --git a/Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TemplateQueueConfig.json b/Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TemplateQueueConfig.json index cd2a190..4251f5b 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TemplateQueueConfig.json +++ b/Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TemplateQueueConfig.json @@ -26,37 +26,9 @@ "teamRules": [] } ], - "matchRules": [ - { - "source": "Players.ExternalData.CloudSave.Skill", - "name": "skill-diff", - "type": "Difference", - "reference": 500, - "overlap": 0.0, - "enableRule": false, - "not": false, - "relaxations": [] - }, - { - "source": "Players.QosResults.Latency", - "name": "QoS", - "type": "LessThanEqual", - "reference": 100, - "overlap": 0.0, - "enableRule": false, - "not": false, - "relaxations": [ - { - "type": "ReferenceControl.Replace", - "ageType": "Oldest", - "atSeconds": 30.0, - "value": 200 - } - ] - } - ] + "matchRules": [] }, - "name": "Default Pool Rules", + "name": "Rules", "backfillEnabled": false }, "matchHosting": { diff --git a/Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Service/QueueConfigTemplate.cs b/Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Service/QueueConfigTemplate.cs index f2176e8..2c910e9 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Service/QueueConfigTemplate.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Service/QueueConfigTemplate.cs @@ -21,36 +21,10 @@ public QueueConfigTemplate() TimeoutSeconds = 90, MatchLogic = new MatchLogicRulesConfig { - Name = "Default Pool Rules", + Name = "Rules", MatchDefinition = new RuleBasedMatchDefinition() { - matchRules = new List() - { - new Rule() - { - name = "skill-diff", - type = RuleType.Difference, - reference = new JsonObject("500"), - source = "Players.ExternalData.CloudSave.Skill" - }, - new Rule() - { - name = "QoS", - type = RuleType.LessThanEqual, - reference = new JsonObject("100"), - source = "Players.QosResults.Latency", - relaxations = new List() - { - new RuleRelaxation() - { - ageType = AgeType.Oldest, - atSeconds = 30, - type = RuleRelaxationType.ReferenceControlReplace, - value = new JsonObject("200") - } - } - } - }, + matchRules = new List(), teams = new List() { new RuleBasedTeamDefinition() diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerClientTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerClientTests.cs index cecbe31..1ec47fe 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerClientTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerClientTests.cs @@ -18,7 +18,7 @@ public class TriggerClientTests public TriggerClientTests() { - m_Trigger = new("1","Trigger1", "EventType1", "cloud-code", "actionUrn") { Path = k_Path }; + m_Trigger = new("1", "Trigger1", "EventType1", "cloud-code", "actionUrn", "") { Path = k_Path }; } [Test] @@ -82,7 +82,7 @@ public void UpdateExceptionPropagates() TestValues.ValidEnvironmentId, "1", It.IsAny(), CancellationToken.None)) .ThrowsAsync(new Exception(exceptionMsg)); - Assert.ThrowsAsync( async () => await client.Update(m_Trigger!) ); + Assert.ThrowsAsync(async () => await client.Update(m_Trigger!)); } [Test] diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerDeploymentHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerDeploymentHandlerTests.cs index a94680a..57168b2 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerDeploymentHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerDeploymentHandlerTests.cs @@ -203,8 +203,8 @@ public async Task DeployAsync_DuplicateIdNotDeleted() { var localTriggers = GetLocalConfigs(); localTriggers.Add( - new TriggerConfig("id3x", "name3", "eventType", "cloud-code", "actionUrn") - { Path = "otherpath.tr"} + new TriggerConfig("id3x", "name3", "eventType", "cloud-code", "actionUrn", "") + { Path = "otherpath.tr" } ); var remoteTriggers = GetRemoteConfigs(); @@ -228,15 +228,15 @@ static List GetLocalConfigs() { var triggers = new List() { - new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn", "") { Path = "path1" }, - new TriggerConfig("id2", "name2", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id2", "name2", "eventType", "cloud-code", "actionUrn", "") { Path = "path2" }, - new TriggerConfig("id3", "name3", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id3", "name3", "eventType", "cloud-code", "actionUrn", "data['someId'] == 'thisId'") { Path = "path3" } @@ -249,11 +249,11 @@ static IReadOnlyList GetRemoteConfigs() var triggers = new List() { - new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn", "") { Path = "Remote" }, - new TriggerConfig("id4", "name4", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id4", "name4", "eventType", "cloud-code", "actionUrn", "data['someId'] == 'thisId'") { Path = "Remote" }, diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchHandlerTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchHandlerTests.cs index 480e1e0..1787c10 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchHandlerTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchHandlerTests.cs @@ -120,7 +120,7 @@ public async Task FetchAsync_WriteNewOnReconcile() ); var expectedFile1 = new TriggersConfigFile( - new List(){(TriggerConfig)remoteTriggers[0]}); + new List() { (TriggerConfig)remoteTriggers[0] }); mockFileSystem .Verify(f => f.WriteAllText( "path1", @@ -128,7 +128,7 @@ public async Task FetchAsync_WriteNewOnReconcile() It.IsAny()), Times.Once); var expectedFile2 = new TriggersConfigFile( - new List(){(TriggerConfig)remoteTriggers[1]}); + new List() { (TriggerConfig)remoteTriggers[1] }); mockFileSystem .Verify(f => f.WriteAllText( Path.Combine("dir", "name2.tr"), @@ -176,7 +176,7 @@ public async Task FetchAsync_DryRunNoCalls() public async Task FetchAsync_DuplicateNameNotDeleted() { var localTriggers = GetLocalConfigs(); - var triggerConfig = new TriggerConfig("otherId", "name1", "changedEventType", "cloud-code", "actionUrn") { Path = "" }; + var triggerConfig = new TriggerConfig("otherId", "name1", "changedEventType", "cloud-code", "actionUrn", "") { Path = "" }; localTriggers.Add(triggerConfig); var remoteTriggers = GetRemoteConfigs(); @@ -209,11 +209,11 @@ static List GetLocalConfigs() { var triggers = new List() { - new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn", "") { Path = "path1" }, - new TriggerConfig("id3", "name3", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id3", "name3", "eventType", "cloud-code", "actionUrn", "") { Path = "path3" } @@ -225,11 +225,11 @@ static List GetRemoteConfigs() { var triggers = new List() { - new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id1", "name1", "eventType", "cloud-code", "actionUrn", "") { Path = "Remote" }, - new TriggerConfig("id2", "name2", "eventType", "cloud-code", "actionUrn") + new TriggerConfig("id2", "name2", "eventType", "cloud-code", "actionUrn", "") { Path = "Remote" }, diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchServiceTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchServiceTests.cs index e8c02e5..ca342b6 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchServiceTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Deploy/TriggerFetchServiceTests.cs @@ -42,8 +42,8 @@ public void SetUp() ) .ReturnsAsync(new TriggersFileItem(new TriggersConfigFile(new List() { - new("Trigger1", "EventType1", "cloud-code", "urn:ugs:cloud-code:MyTestScript"), - new("Trigger2", "EventType2", "cloud-code", "urn:ugs:cloud-code:MyTestScript") + new("Trigger1", "EventType1", "cloud-code", "urn:ugs:cloud-code:MyTestScript",""), + new("Trigger2", "EventType2", "cloud-code", "urn:ugs:cloud-code:MyTestScript", "") }), "samplePath")); var deployResult = new FetchResult() diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Service/TriggersServiceTests.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Service/TriggersServiceTests.cs index 9b97cec..f3c9acf 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Service/TriggersServiceTests.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Service/TriggersServiceTests.cs @@ -64,7 +64,7 @@ public async Task ListAsync_Success() m_ValidatorObject.Setup(v => v.IsConfigValid(It.IsAny(), It.IsAny(), out mockErrorMsg)) .Returns(true); - var result = new TriggerConfigPage(Guid.Empty, Guid.Empty, new List(){new (), new()}); + var result = new TriggerConfigPage(Guid.Empty, Guid.Empty, new List() { new(), new() }); m_TriggersApiMock.Setup( t => t.ListTriggerConfigsAsync( It.Is(id => id.ToString() == k_ValidProjectId), @@ -134,7 +134,7 @@ public async Task UpdateAsync_Succeeded() string mockErrorMsg; m_ValidatorObject.Setup(v => v.IsConfigValid(It.IsAny(), It.IsAny(), out mockErrorMsg)) .Returns(true); - var updatedConfig = new TriggerConfigBody("name", "eventType", TriggerActionType.CloudCode, "urn"); + var updatedConfig = new TriggerConfigBody("name", "eventType", TriggerActionType.CloudCode, "urn", "filter"); m_TriggersApiMock.Setup( t => t.DeleteTriggerConfigAsync( It.Is(id => id.ToString() == k_ValidProjectId), diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Unity.Services.Cli.Triggers.UnitTest.csproj b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Unity.Services.Cli.Triggers.UnitTest.csproj index a810de9..c99c000 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Unity.Services.Cli.Triggers.UnitTest.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Unity.Services.Cli.Triggers.UnitTest.csproj @@ -15,7 +15,7 @@ - + diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersClient.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersClient.cs index ae1294d..9ef764b 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersClient.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersClient.cs @@ -58,7 +58,8 @@ await m_Service.UpdateTriggerAsync( triggerConfig.Name, triggerConfig.EventType, JsonConvert.DeserializeObject($"\"{triggerConfig.ActionType}\""), - triggerConfig.ActionUrn), + triggerConfig.ActionUrn, + triggerConfig.Filter), CancellationToken); } @@ -71,7 +72,8 @@ await m_Service.CreateTriggerAsync( triggerConfig.Name, triggerConfig.EventType, JsonConvert.DeserializeObject($"\"{triggerConfig.ActionType}\""), - triggerConfig.ActionUrn), + triggerConfig.ActionUrn, + triggerConfig.Filter), CancellationToken); } @@ -104,6 +106,7 @@ static TriggerConfig FromResponse(Gateway.TriggersApiV1.Generated.Model.TriggerC Id = responseConfig.Id.ToString(), Name = responseConfig.Name, Path = "Remote", + Filter = responseConfig.Filter, }; } } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersConfigFile.cs b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersConfigFile.cs index 4be8b18..7ed68d1 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersConfigFile.cs +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersConfigFile.cs @@ -22,8 +22,9 @@ public TriggersConfigFile() { Configs = new List() { - new ("Trigger 1", "EventType1", "cloud-code", "urn:ugs:cloud-code:MyScript"), - new ("Trigger 2", "EventType2", "cloud-code", "urn:ugs:cloud-code:MyModule/MyFunction") + new ("Trigger 1", "EventType1", "cloud-code", "urn:ugs:cloud-code:MyScript", ""), + new ("Trigger 2", "EventType2", "cloud-code", "urn:ugs:cloud-code:MyModule/MyFunction", ""), + new ("Trigger 3", "EventType3", "cloud-code", "urn:ugs:cloud-code:MyModule/MyFunction", "data['value'] > 5") }; } diff --git a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Unity.Services.Cli.Triggers.csproj b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Unity.Services.Cli.Triggers.csproj index 6c17ce3..bb9ecd4 100644 --- a/Unity.Services.Cli/Unity.Services.Cli.Triggers/Unity.Services.Cli.Triggers.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli.Triggers/Unity.Services.Cli.Triggers.csproj @@ -21,7 +21,7 @@ - + $(DefineConstants);$(ExtraDefineConstants) diff --git a/Unity.Services.Cli/Unity.Services.Cli/Unity.Services.Cli.csproj b/Unity.Services.Cli/Unity.Services.Cli/Unity.Services.Cli.csproj index a8c2f43..6fe53a7 100644 --- a/Unity.Services.Cli/Unity.Services.Cli/Unity.Services.Cli.csproj +++ b/Unity.Services.Cli/Unity.Services.Cli/Unity.Services.Cli.csproj @@ -4,7 +4,7 @@ net8.0 10 ugs - 1.6.0 + 1.7.0 true true diff --git a/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/ITriggerConfig.cs b/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/ITriggerConfig.cs index 25c8543..fe02291 100644 --- a/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/ITriggerConfig.cs +++ b/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/ITriggerConfig.cs @@ -10,5 +10,6 @@ public interface ITriggerConfig : IDeploymentItem, ITypedItem string EventType { get; } string ActionType { get; } string ActionUrn { get; } + string Filter { get; } } } diff --git a/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/TriggerConfig.cs b/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/TriggerConfig.cs index f1cc467..050bf7a 100644 --- a/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/TriggerConfig.cs +++ b/Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/TriggerConfig.cs @@ -20,6 +20,8 @@ public class TriggerConfig : ITriggerConfig public string ActionType { get; set; } [DataMember] public string ActionUrn { get; set; } + [DataMember] + public string Filter { get; set; } public string Path { get; set; } public event PropertyChangedEventHandler PropertyChanged; @@ -34,21 +36,23 @@ public TriggerConfig() } [JsonConstructor] - public TriggerConfig(string name, string eventType, string actionType, string actionUrn) + public TriggerConfig(string name, string eventType, string actionType, string actionUrn, string filter) { Name = name; EventType = eventType; ActionType = actionType; ActionUrn = actionUrn; + Filter = filter; } - public TriggerConfig(string id, string name, string eventType, string actionType, string actionUrn) + public TriggerConfig(string id, string name, string eventType, string actionType, string actionUrn, string filter) { Id = id; Name = name; EventType = eventType; ActionType = actionType; ActionUrn = actionUrn; + Filter = filter; } protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)