Skip to content

Commit 68273aa

Browse files
committed
refactor(build): enhance test task with improved console output and refined platform checks
- Replace basic context.Warning calls with rich Spectre.Console output via ConsoleHelper - Use ConsoleHelper.WriteRule() for elegant test section headers - Use ConsoleHelper.WriteInfo/Warning/Processing/Success for better visual feedback - Refine net462 platform check to only skip tests on Linux (not macOS) - Improve messaging for docker container cleanup operations The changes provide better visual feedback during test execution and allow net462 tests to run on macOS while still preventing issues on Linux where external Mono installation would be required.
1 parent 1771443 commit 68273aa

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LocalStack .NET Client
22

3-
[![Nuget](https://img.shields.io/nuget/dt/LocalStack.Client)](https://www.nuget.org/packages/LocalStack.Client/) [![NuGet v2.x](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2F%3Fpackage%3Dlocalstack.client%26source%3Dnuget%26track%3D2%26includeprerelease%3Dtrue%26label%3Dnuget)](https://www.nuget.org/packages/LocalStack.Client/) [![NuGet v1.x](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2F%3Fpackage%3Dlocalstack.client%26source%3Dnuget%26track%3D1%26includeprerelease%3Dtrue%26label%3Dnuget)](https://www.nuget.org/packages/LocalStack.Client/) [![CI/CD Pipeline](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/ci-cd.yml) [![Security](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/github-code-scanning/codeql) [![Linux Tests](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2Fbadge%2Ftests%2Flinux%3Flabel%3DTests%26track%3Dv1)](https://yvfdbfas85.execute-api.eu-central-1.amazonaws.com/live/redirect/test-results/linux?track=v1)
3+
[![Nuget](https://img.shields.io/nuget/dt/LocalStack.Client)](https://www.nuget.org/packages/LocalStack.Client/) [![NuGet v2.x](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2F%3Fpackage%3Dlocalstack.client%26source%3Dnuget%26track%3D2%26includeprerelease%3Dtrue%26label%3Dnuget)](https://www.nuget.org/packages/LocalStack.Client/) [![NuGet v1.x](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2F%3Fpackage%3Dlocalstack.client%26source%3Dnuget%26track%3D1%26includeprerelease%3Dtrue%26label%3Dnuget)](https://www.nuget.org/packages/LocalStack.Client/) [![CI/CD Pipeline](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/ci-cd.yml) [![Security](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/localstack-dotnet/localstack-dotnet-client/actions/workflows/github-code-scanning/codeql) [![macOS Tests](https://img.shields.io/endpoint?url=https%3A%2F%2Fyvfdbfas85.execute-api.eu-central-1.amazonaws.com%2Flive%2Fbadge%2Ftests%2Fmacos%3Flabel%3DTests%26track%3Dv1)](https://yvfdbfas85.execute-api.eu-central-1.amazonaws.com/live/redirect/test-results/linux?track=v1)
44

55
> ## ⚠️ Maintenance Branch for AWS SDK v3 ⚠️
66
>

build/LocalStack.Build/CakeTasks/TestTask.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,31 @@ public override void Run(BuildContext context)
1717
string testProjectPath = testProj.CsProjPath;
1818
string targetFrameworks = string.Join(',', testProj.TargetFrameworks);
1919

20-
context.Warning($"Target Frameworks {targetFrameworks}");
20+
ConsoleHelper.WriteInfo($"Target Frameworks: {targetFrameworks}");
2121

2222
foreach (string targetFramework in testProj.TargetFrameworks)
2323
{
2424
if (context.SkipFunctionalTest && testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
2525
{
26-
context.Warning("Skipping Functional Tests");
26+
ConsoleHelper.WriteWarning("Skipping Functional Tests");
2727

2828
continue;
2929
}
3030

31-
context.Warning(
32-
$"=============Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}=============");
31+
ConsoleHelper.WriteRule($"Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}");
3332
settings.Framework = targetFramework;
3433

3534
if (testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
3635
{
37-
context.Warning("Deleting running docker containers");
36+
ConsoleHelper.WriteProcessing("Deleting running docker containers");
3837

3938
try
4039
{
4140
string psOutput = context.DockerPs(new DockerContainerPsSettings() { All = true, Quiet = true });
4241

4342
if (!string.IsNullOrEmpty(psOutput))
4443
{
45-
context.Warning(psOutput);
44+
ConsoleHelper.WriteInfo($"Found containers: {psOutput}");
4645

4746
string[] containers = psOutput.Split([Environment.NewLine], StringSplitOptions.None);
4847
context.DockerRm(containers);
@@ -54,17 +53,17 @@ public override void Run(BuildContext context)
5453
}
5554
}
5655

57-
if (targetFramework == "net462" && !context.IsRunningOnWindows())
56+
if (targetFramework == "net462" && context.IsRunningOnLinux())
5857
{
59-
context.Warning("Skipping net462 tests on non-Windows platform");
58+
ConsoleHelper.WriteWarning("Skipping net462 tests on Linux platform (requires external Mono)");
6059
continue;
6160
}
6261

6362
string testFilePrefix = targetFramework.Replace('.', '-');
6463
settings.ArgumentCustomization = args => args.Append($" --logger \"trx;LogFileName={testFilePrefix}_{testResults}\"");
6564
context.DotNetTest(testProjectPath, settings);
6665

67-
context.Warning("==============================================================");
66+
ConsoleHelper.WriteSuccess($"Completed {targetFramework} tests for {testProj.AssemblyName}");
6867
}
6968
}
7069
}

0 commit comments

Comments
 (0)