Skip to content

Commit 0f12d33

Browse files
author
Christoph Bühler
committed
test: allow tests to be run in Release mode
1 parent 31b2ab0 commit 0f12d33

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

.github/workflows/dotnet-test.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
build:
14-
name: Building
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v3
18-
19-
- name: Setup .NET
20-
uses: actions/setup-dotnet@v3
21-
with:
22-
dotnet-version: 7.x
23-
24-
- name: Execute Tests
25-
run: dotnet build --configuration Release
26-
2713
test:
2814
name: Testing
2915
runs-on: ubuntu-latest
@@ -39,4 +25,4 @@ jobs:
3925
uses: helm/[email protected]
4026

4127
- name: Execute Tests
42-
run: dotnet test
28+
run: dotnet test --configuration Release

test/KubeOps.Operator.Test/MlcProvider.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ static MlcProvider()
2121

2222
public async Task InitializeAsync()
2323
{
24+
var assemblyConfigurationAttribute =
25+
typeof(MlcProvider).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();
26+
var buildConfigurationName = assemblyConfigurationAttribute?.Configuration ?? "Debug";
27+
2428
try
2529
{
2630
await Semaphore.WaitAsync();
27-
using var workspace = MSBuildWorkspace.Create();
31+
using var workspace = MSBuildWorkspace.Create(new Dictionary<string, string>
32+
{
33+
{ "Configuration", buildConfigurationName },
34+
});
2835
workspace.SkipUnrecognizedProjects = true;
2936
workspace.LoadMetadataForReferencedProjects = true;
3037
var project = await workspace.OpenProjectAsync("../../../KubeOps.Operator.Test.csproj");

test/KubeOps.Transpiler.Test/MlcProvider.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ static MlcProvider()
1717

1818
public async Task InitializeAsync()
1919
{
20-
using var workspace = MSBuildWorkspace.Create();
20+
var assemblyConfigurationAttribute =
21+
typeof(MlcProvider).Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>();
22+
var buildConfigurationName = assemblyConfigurationAttribute?.Configuration ?? "Debug";
23+
24+
using var workspace = MSBuildWorkspace.Create(new Dictionary<string, string>
25+
{
26+
{ "Configuration", buildConfigurationName },
27+
});
28+
2129
workspace.SkipUnrecognizedProjects = true;
2230
workspace.LoadMetadataForReferencedProjects = true;
2331
var project = await workspace.OpenProjectAsync("../../../KubeOps.Transpiler.Test.csproj");

toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
href: src/KubeOps.Cli/README.md
1111
- name: KubeOps Generator
1212
href: src/KubeOps.Generator/README.md
13-
- name: KubeOps Operator
14-
href: src/KubeOps.Operator/README.md
1513
- name: KubeOps Kubernetes Client
1614
href: src/KubeOps.KubernetesClient/README.md
15+
- name: KubeOps Operator
16+
href: src/KubeOps.Operator/README.md
1717
- name: KubeOps Operator Web
1818
href: src/KubeOps.Operator.Web/README.md
1919
- name: KubeOps Transpiler

0 commit comments

Comments
 (0)