Skip to content

Commit

Permalink
test: allow tests to be run in Release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Bühler committed Oct 11, 2023
1 parent 31b2ab0 commit 0f12d33
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x

- name: Execute Tests
run: dotnet build --configuration Release

test:
name: Testing
runs-on: ubuntu-latest
Expand All @@ -39,4 +25,4 @@ jobs:
uses: helm/kind-action@v1.8.0

- name: Execute Tests
run: dotnet test
run: dotnet test --configuration Release
9 changes: 8 additions & 1 deletion test/KubeOps.Operator.Test/MlcProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ static MlcProvider()

public async Task InitializeAsync()
{
var assemblyConfigurationAttribute =
typeof(MlcProvider).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();
var buildConfigurationName = assemblyConfigurationAttribute?.Configuration ?? "Debug";

try
{
await Semaphore.WaitAsync();
using var workspace = MSBuildWorkspace.Create();
using var workspace = MSBuildWorkspace.Create(new Dictionary<string, string>
{
{ "Configuration", buildConfigurationName },
});
workspace.SkipUnrecognizedProjects = true;
workspace.LoadMetadataForReferencedProjects = true;
var project = await workspace.OpenProjectAsync("../../../KubeOps.Operator.Test.csproj");
Expand Down
10 changes: 9 additions & 1 deletion test/KubeOps.Transpiler.Test/MlcProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ static MlcProvider()

public async Task InitializeAsync()
{
using var workspace = MSBuildWorkspace.Create();
var assemblyConfigurationAttribute =
typeof(MlcProvider).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();
var buildConfigurationName = assemblyConfigurationAttribute?.Configuration ?? "Debug";

using var workspace = MSBuildWorkspace.Create(new Dictionary<string, string>
{
{ "Configuration", buildConfigurationName },
});

workspace.SkipUnrecognizedProjects = true;
workspace.LoadMetadataForReferencedProjects = true;
var project = await workspace.OpenProjectAsync("../../../KubeOps.Transpiler.Test.csproj");
Expand Down
4 changes: 2 additions & 2 deletions toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
href: src/KubeOps.Cli/README.md
- name: KubeOps Generator
href: src/KubeOps.Generator/README.md
- name: KubeOps Operator
href: src/KubeOps.Operator/README.md
- name: KubeOps Kubernetes Client
href: src/KubeOps.KubernetesClient/README.md
- name: KubeOps Operator
href: src/KubeOps.Operator/README.md
- name: KubeOps Operator Web
href: src/KubeOps.Operator.Web/README.md
- name: KubeOps Transpiler
Expand Down

0 comments on commit 0f12d33

Please sign in to comment.