-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from NoxOrg/bugfix/powershell-error-message
- changed powershell script error reporting
- Loading branch information
Showing
3 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Plugin.Powershell.Tests/Plugin.Powershell.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"/> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> | ||
<PackageReference Include="xunit" Version="2.5.3"/> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="Xunit"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Nox.Cli.Plugins\Nox.Cli.Plugin.Powershell\Nox.Cli.Plugin.Powershell.csproj" /> | ||
<ProjectReference Include="..\Nox.Cli.Variables\Nox.Cli.Variables.csproj" /> | ||
<ProjectReference Include="..\Nox.Cli\Nox.Cli.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Moq; | ||
using Nox.Cli.Abstractions; | ||
using Nox.Cli.Abstractions.Caching; | ||
using Nox.Cli.Actions; | ||
using Nox.Cli.Configuration; | ||
using Nox.Cli.Plugins.Powershell; | ||
using Nox.Cli.Variables.Secrets; | ||
using Nox.Secrets.Abstractions; | ||
using Nox.Solution; | ||
|
||
namespace Plugin.Powershell.Tests; | ||
|
||
public class ScriptTests | ||
{ | ||
[Fact] | ||
public async Task Can_perform_a_git_pull() | ||
{ | ||
Directory.SetCurrentDirectory("/home/jan/Projects/IWG/Fno.MultiDeploy"); | ||
var plugin = new PowershellScript_v1(); | ||
var inputs = new Dictionary<string, object> | ||
{ | ||
{"script", "git pull --rebase iwgplc main"}, | ||
}; | ||
await plugin.BeginAsync(inputs); | ||
var wfConfig = new WorkflowConfiguration(); | ||
var sln = Mock.Of<NoxSolution>(); | ||
var orgResolver = Mock.Of<IOrgSecretResolver>(); | ||
var cacheMan = Mock.Of<INoxCliCacheManager>(); | ||
var lteConfig = Mock.Of<LocalTaskExecutorConfiguration>(); | ||
var secretsResolver = Mock.Of<INoxSecretsResolver>(); | ||
var ctx = new NoxWorkflowContext(wfConfig, sln, orgResolver, cacheMan, lteConfig, secretsResolver); | ||
await plugin.ProcessAsync(ctx); | ||
Console.WriteLine(ctx.CurrentAction!.ErrorMessage!); | ||
Assert.Equal(ActionState.Success, ctx.State); | ||
} | ||
} |