-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests with netstandard2.0/2.1 version of KubernetesClient without .NET Core 3.1 #1029
Conversation
…Client.Test projects
…/kubernetes-client-csharp into netstandard2.1-compilation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: m3nax The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Related #988 |
Not sure if the compiler today takes it could you please link me any official doc about the property? |
Conditional inclusion: https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditional-constructs?view=vs-2022 |
I mean |
looks like the idea is to override the thanks for the idea |
Yes you are right, is the equivalent of |
For |
netstardard 2.0 is for net48, but asp.net core cant start with net48. Ah, I think we do not have to do this tricky workaround. while, the aspnetcore is to mock a http server here until a better http lib for test found. lets target netstanard2 directly to see if we start there :) |
I removed the tests for the netstandard2.0 version while keeping the dependency on the netstandard2.0 version of the dependency in the project file. I merged the latest version of the master, are there any other changes to make? |
<PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
<RootNamespace>k8s.Tests</RootNamespace> | ||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> | |
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks> |
what about this?
any idea to fix asp.net?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't target netstandard2.0/2.1 directly inside test project because , as stated in the docs
.NET Standard is a formal specification of .NET APIs that are available on multiple .NET implementations.
and depends by the framework implementation of the apis docs.
xunit can't directly test netstandard because like other programs, require the netstandard api implementation to run xunit docs
The additional property is the only trick i know to test netstandard implementation with xunit.
I tested on my machine the suggestion and, as i wrote, i can't build test project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup that is where i stopped.
prefer it than changing target during build.
it is not testing what is really shipped to nuget.
With this version:
Steps to test this version (netstandard2.0):
Steps to test this version (netstandard2.1):
|
/assign @tg123 If you don't like the proposed solution, close the PR. |
@m3nax: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Closed because implemented in #1122 with netstandard2.1 removal |
After a long journey looking for a way to compile test projects by forcing the use of a specific version of a "ProjectReference" I wrote the following pipeline.
Now it is certain that the compiler takes the netstandard2.1 version of the library.
How test the solution:
dotnet build -f netstandard2.1 --configuration Debug -v minimal ./src/KubernetesClient/KubernetesClient.csproj
dotnet build -f netstandard2.0 --configuration Debug -v minimal ./tests/SkipTestLogger/SkipTestLogger.csproj
Now set the flag UseLibNetStandard2_1 to false or omit it
dotnet build --configuration Debug -v minimal --no-dependencies -p:UseLibNetStandard2_1=false ./tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
dotnet build --configuration Debug -v minimal --no-dependencies -p:UseLibNetStandard2_1=false ./tests/E2E.Tests/E2E.Tests.csproj
Now set the flag UseLibNetStandard2_1 to true
dotnet build --configuration Debug -v minimal --no-dependencies -p:UseLibNetStandard2_1=true ./tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
dotnet build --configuration Debug -v minimal --no-dependencies -p:UseLibNetStandard2_1=true ./tests/E2E.Tests/E2E.Tests.csproj
It switch between forced and standard inclusion of ProjectReference inside KubernetesClient.Tests.csproj and E2E.Tests.csproj: