Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Run Nuke Build 🏗
id: nuke-build
env:
Expand Down
6 changes: 3 additions & 3 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Build : NukeBuild
[PackageExecutable(
packageId: "OctoVersion.Tool",
packageExecutable: "OctoVersion.Tool.dll",
Framework = "net6.0")]
Framework = "net8.0")]
readonly Tool OctoVersion;

[PackageExecutable(
Expand Down Expand Up @@ -167,7 +167,7 @@ class Build : NukeBuild
var portablePublishDir = OctoPublishDirectory / "portable";
DotNetPublish(_ => _
.SetProject(Solution.Octo)
.SetFramework("netcoreapp3.1")
.SetFramework("net8.0")
.SetConfiguration(Configuration)
.SetOutput(portablePublishDir)
.SetVersion(fullSemVer));
Expand All @@ -188,7 +188,7 @@ class Build : NukeBuild
DotNetPublish(_ => _
.SetProject(Solution.Octo)
.SetConfiguration(Configuration)
.SetFramework("net6.0")
.SetFramework("net8.0")
.SetRuntime(rid)
.EnableSelfContained()
.EnablePublishSingleFile()
Expand Down
2 changes: 1 addition & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.0.1" />
<PackageReference Include="SharpCompress" Version="0.29.0" />
<PackageReference Include="SharpCompress" Version="0.39.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion build/_build.csproj.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -24,4 +26,5 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.101",
"version": "8.0.407",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,38 @@ public void ShouldBeAttachedWithCorrectAttribute()
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public void ShouldValidateProjectIdOrNameParameterForMissing(string projectIdOrName)
public async Task ShouldValidateProjectIdOrNameParameterForMissing(string projectIdOrName)
{
CommandLineArgs.Add($"--project={projectIdOrName}");
CommandLineArgs.Add($"--version={releaseResource.Version}");

Func<Task> exec = () => allowReleaseProgressionCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a project name or ID using the parameter: --project=XYZ");
}

[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public void ShouldValidateReleaseVersionNumberParameterForMissing(string releaseVersionNumber)
public async Task ShouldValidateReleaseVersionNumberParameterForMissing(string releaseVersionNumber)
{
CommandLineArgs.Add($"--project={projectResource.Name}");
CommandLineArgs.Add($"--version={releaseVersionNumber}");

Func<Task> exec = () => allowReleaseProgressionCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a release version number using the version parameter: --version=1.0.5");
}

[TestCase("9999999999999999999999999999999999999")]
[Description("Version number larger than an int")]
public void ShouldValidateReleaseVersionNumberParameterForFormat(string releaseVersionNumber)
public async Task ShouldValidateReleaseVersionNumberParameterForFormat(string releaseVersionNumber)
{
CommandLineArgs.Add($"--project={projectResource.Name}");
CommandLineArgs.Add($"--version={releaseVersionNumber}");

Func<Task> exec = () => allowReleaseProgressionCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please provide a valid release version format: --version=1.0.5");
}

Expand All @@ -123,7 +123,7 @@ public async Task ShouldSupportBothReleaseNumberAndVersionArgForReleaseVersionNu
}

[Test]
public void ShouldThrowCorrectException_WhenReleaseNotFound()
public async Task ShouldThrowCorrectException_WhenReleaseNotFound()
{
Repository.Projects.GetReleaseByVersion(projectResource, releaseResource.Version).Returns((ReleaseResource)null);

Expand All @@ -132,7 +132,7 @@ public void ShouldThrowCorrectException_WhenReleaseNotFound()

Func<Task> exec = () => allowReleaseProgressionCommand.Execute(CommandLineArgs.ToArray());

exec.ShouldThrow<OctopusResourceNotFoundException>();
await exec.Should().ThrowAsync<OctopusResourceNotFoundException>();
}

[Test]
Expand Down
10 changes: 5 additions & 5 deletions source/Octo.Tests/Commands/ApiCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public void ShouldNotThrowIfServerSetInEnvVar()
}

[Test]
public void ShouldThrowIfInvalidCommandLineParametersArePassed()
public async Task ShouldThrowIfInvalidCommandLineParametersArePassed()
{
CommandLineArgs.Add("--fail=epic");
Func<Task> exec = () => apiCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>();
await exec.Should().ThrowAsync<CommandException>();
}

[Test]
Expand Down Expand Up @@ -134,11 +134,11 @@ public async Task ShouldRunWithinASpaceWhenSpaceNameSpecified()
}));

await apiCommand.Execute(argsWithSpaceName.ToArray()).ConfigureAwait(false);
Assert.IsTrue(isInRightSpaceContext);
Assert.That(isInRightSpaceContext, Is.True);
}

[Test]
public void ShouldThrowWhenThereIsNoSpaceMatchTheProvidedName()
public async Task ShouldThrowWhenThereIsNoSpaceMatchTheProvidedName()
{
var client = Substitute.For<IOctopusAsyncClient>();
ClientFactory.CreateAsyncClient(null).ReturnsForAnyArgs(client);
Expand All @@ -150,7 +150,7 @@ public void ShouldThrowWhenThereIsNoSpaceMatchTheProvidedName()
var argsWithSpaceName = CommandLineArgs.Concat(new[] { "--space=nonExistent" });

Func<Task> action = async () => await apiCommand.Execute(argsWithSpaceName.ToArray()).ConfigureAwait(false);
action.ShouldThrow<CommandException>().WithMessage("Cannot find the space with name or id 'nonExistent'. Please check the spelling and that you have permissions to view it. Please use Configuration > Test Permissions to confirm.");
await action.Should().ThrowAsync<CommandException>().WithMessage("Cannot find the space with name or id 'nonExistent'. Please check the spelling and that you have permissions to view it. Please use Configuration > Test Permissions to confirm.");
}
}
}
12 changes: 6 additions & 6 deletions source/Octo.Tests/Commands/CleanEnvironmentCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,30 @@ public void ShouldRemoveMachinesBelongingToMultipleEnvironmentsInsteadOfDeleting
}

[Test]
public void ShouldNotCleanEnvironmentWithMissingEnvironmentArgs()
public async Task ShouldNotCleanEnvironmentWithMissingEnvironmentArgs()
{
Func<Task> exec = () => listMachinesCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify an environment name using the parameter: --environment=XYZ");
}

[Test]
public void ShouldNotCleanEnvironmentWithMissingStatusArgs()
public async Task ShouldNotCleanEnvironmentWithMissingStatusArgs()
{
CommandLineArgs.Add("-environment=Development");
Func<Task> exec = () => listMachinesCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a status using the parameter: --status or --health-status");
}

[Test]
public void ShouldNotCleanTheEnvironmentIfEnvironmentNotFound()
public async Task ShouldNotCleanTheEnvironmentIfEnvironmentNotFound()
{
CommandLineArgs.Add("-environment=Development");
CommandLineArgs.Add("-status=Offline");

Func<Task> exec = () => listMachinesCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CouldNotFindException>()
await exec.Should().ThrowAsync<CouldNotFindException>()
.WithMessage("Could not find the specified environment; either it does not exist or you lack permissions to view it.");
}

Expand Down
12 changes: 6 additions & 6 deletions source/Octo.Tests/Commands/CleanWorkerPoolCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,30 @@ public void ShouldRemoveMachinesBelongingToMultiplePoolsInsteadOfDeleting()
}

[Test]
public void ShouldNotCleanPoolWithMissingPoolArgs()
public async Task ShouldNotCleanPoolWithMissingPoolArgs()
{
Func<Task> exec = () => cleanPoolCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a worker pool name using the parameter: --workerpool=XYZ");
}

[Test]
public void ShouldNotCleanPoolWithMissingStatusArgs()
public async Task ShouldNotCleanPoolWithMissingStatusArgs()
{
CommandLineArgs.Add("-workerpool=SomePool");
Func<Task> exec = () => cleanPoolCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a status using the parameter: --health-status");
}

[Test]
public void ShouldNotCleanIfPoolNotFound()
public async Task ShouldNotCleanIfPoolNotFound()
{
CommandLineArgs.Add("-workerpool=SomePool");
CommandLineArgs.Add("-health-status=Unhealthy");

Func<Task> exec = () => cleanPoolCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CouldNotFindException>()
await exec.Should().ThrowAsync<CouldNotFindException>()
.WithMessage("Could not find the specified worker pool; either it does not exist or you lack permissions to view it.");
}

Expand Down
8 changes: 4 additions & 4 deletions source/Octo.Tests/Commands/CreateChannelCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public void SetUp()
}

[Test]
public void ShouldThrowBecauseOfMissingParameters()
public async Task ShouldThrowBecauseOfMissingParameters()
{
Func<Task> exec = () => createChannelCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>();
await exec.Should().ThrowAsync<CommandException>();
}

[Test]
public void ShouldThrowForOlderOctopusServers()
public async Task ShouldThrowForOlderOctopusServers()
{
Repository.LoadRootDocument()
.Returns(new RootResource
Expand All @@ -42,7 +42,7 @@ public void ShouldThrowForOlderOctopusServers()
CommandLineArgs.Add($"--lifecycle={$"Lifecycle-{Guid.NewGuid()}"}");

Func<Task> exec = () => createChannelCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>();
await exec.Should().ThrowAsync<CommandException>();
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions source/Octo.Tests/Commands/CreateReleaseCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void ShouldLoadOptionsFromFile()
createReleaseCommand.Execute("--configfile=Commands/Resources/CreateRelease.config.txt");
});

Assert.AreEqual("Test Project", createReleaseCommand.ProjectNameOrId);
Assert.AreEqual("1.0.0", createReleaseCommand.VersionNumberParameterValue);
Assert.AreEqual("Test config file.", createReleaseCommand.ReleaseNotes);
Assert.That("Test Project", Is.EqualTo( createReleaseCommand.ProjectNameOrId));
Assert.That("1.0.0", Is.EqualTo( createReleaseCommand.VersionNumberParameterValue));
Assert.That("Test config file.", Is.EqualTo(createReleaseCommand.ReleaseNotes));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public async Task ShouldDeleteOverrideForEnvironment()

LogLines.Should().Contain("Deleted auto deploy release override for the project OctoFx to the environment Production");
await Repository.Projects.ReceivedWithAnyArgs().Modify(null).ConfigureAwait(false);
Assert.True(!savedProject.AutoDeployReleaseOverrides.Any());
Assert.That(!savedProject.AutoDeployReleaseOverrides.Any(), Is.True);
}

[Test]
Expand All @@ -100,7 +100,7 @@ public async Task ShouldDeleteOverrideForTenantByName()

LogLines.Should().Contain("Deleted auto deploy release override for the project OctoFx to the environment Production and tenant Octopus");
await Repository.Projects.ReceivedWithAnyArgs().Modify(null).ConfigureAwait(false);
Assert.True(!savedProject.AutoDeployReleaseOverrides.Any());
Assert.That(!savedProject.AutoDeployReleaseOverrides.Any(), Is.True);
}

[Test]
Expand All @@ -116,7 +116,7 @@ public async Task ShouldDeleteOverrideForTenantByTag()

LogLines.Should().Contain("Deleted auto deploy release override for the project OctoFx to the environment Production and tenant Octopus");
await Repository.Projects.ReceivedWithAnyArgs().Modify(null).ConfigureAwait(false);
Assert.True(!savedProject.AutoDeployReleaseOverrides.Any());
Assert.That(!savedProject.AutoDeployReleaseOverrides.Any(), Is.True);
}

[Test]
Expand Down
14 changes: 7 additions & 7 deletions source/Octo.Tests/Commands/DeletePackageCommandFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ public async Task DefaultOutput_ShouldDeleteTheGivenPackage()
deletePackageCommand.PrintJsonOutput();

var logOutput = LogOutput.ToString();
Assert.True(logOutput.Contains("\"Status\": \"Success\""));
Assert.True(logOutput.Contains($"\"PackageId\": \"{packageId}\""));
Assert.True(logOutput.Contains($"\"Version\": \"{packageVersion}\""));
logOutput.Should().Contain("\"Status\": \"Success\"");
logOutput.Should().Contain($"\"PackageId\": \"{packageId}\"");
logOutput.Should().Contain($"\"Version\": \"{packageVersion}\"");
}

[Test]
public void CommandException_ShouldNotSearchForPackageWhenThereIsNoPackageId()
public async Task CommandException_ShouldNotSearchForPackageWhenThereIsNoPackageId()
{
Func<Task> exec = () => deletePackageCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a package id using the parameter: --packageId=XYZ");
}

[Test]
public void CommandException_ShouldNotSearchForPackageWhenThereIsNoPackageVersion()
public async Task CommandException_ShouldNotSearchForPackageWhenThereIsNoPackageVersion()
{
deletePackageCommand.PackageId = "TestPackage";
Func<Task> exec = () => deletePackageCommand.Execute(CommandLineArgs.ToArray());
exec.ShouldThrow<CommandException>()
await exec.Should().ThrowAsync<CommandException>()
.WithMessage("Please specify a package version using the parameter: --version=1.0.0");
}
}
Expand Down
Loading