-
Notifications
You must be signed in to change notification settings - Fork 68
SBRP validation tests #817
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
Conversation
|
@mthalman @MichaelSimons SBRP Validation tests require investigating the built packages. The reason the build is failing in this PR is that the job for running the tests does not execute a build (this was not an issue for GenerateScriptTests.cs as it was independent of the build job). Due to this, some refactoring must be done. Given that the tests are run on Windows and Linux, I'm wondering if we would consider running 3 jobs rather than 4. This would mean changing the pipeline. The current pipeline is: My proposed pipeline is: The other alternative I can think of would be to publish the built packages from the current pipeline's job 1 in a tar.gz and then download and unpack them as a step in the current pipeline's jobs 2 and 3. |
Note that SBRPs can't be built on Windows today as building the targeting pack is currently only supported on Unix. It should be possible to change that though. The proposed pipeline refactoring looks good and follows the recommended vertical build model. FWIW I'm not sure if merging the test projects together is an improvement. The existing test project doesn't require the SBRP packages to be generated while the new test does require that. I would probably keep them separated. That will allow you to keep the existing tests running on Windows. |
This is mentioned in more detail in GitHub Issue #3724.
I agree that even though the generate tests are independent of SBRP package generation, there is a case to be made for consolidating the test projects. As an example, the SmokeTests in the VMR are all contained within a single test project; this format promotes a more uniform code structure and reduces redundancy. Additionally, if there's a need to skip tests in the future, implementing tests as SkippableFacts/SkippableTheories would be a straightforward solution. |
We have hundreds of test projects in dotnet/runtime, because they test different components, i.e.
I have to disagree on that. What enables a uniform code structure are analyzers and .editorconfig rules and ruleset files but definitely not a single test project.
Straightforward sure, but you want to skip tests based on parameters like the machine configuration / the runtime or other traits. You don't want to express your build dependencies and order via xunit traits. How would you keep the existing generate script tests enabled when merging the test projects? Disabling them on Windows, even temporarily isn't an improvement. |
|
I've had a few discussions with @MichaelSimons and @mthalman on the points you bring up. I can understand the reasons for splitting these tests into two different projects; the generate tests are testing the generation logic, and the SBRP tests are testing package "traits". Since they are testing two different components of the repo, I agree that there is reason behind splitting up the tests into two different projects. However, this is a small repo, much smaller than dotnet/runtime. I think there because of this, there is value to the tests sharing a singular test project in this repo given its size.
I recognize that this may not have come across as I had intended it to. I was not referring to the stylistic code structure of the tests, but rather the organization and grouping of data. My point was that by using a singular test project in this instance, we reduce the amount of repeated code, such as the RepoRoot variable and even the .proj files.
It is still possible to skip tests based on these factors. For example, it's possible to determine the OS version and skip based on that. Ultimately, I acknowledge there are reasons to both sides. If there is a significant preference for multiple test projects over a singular test project, I am happy to make that change. As of right now, I am choosing to leave the tests in a singular project. |
I'm still not seeing how you can make this change without disabling the existing tests on Windows. See my question above:
|
That logic is here. The test is a skippable fact, skipped if the OS is Windows. I also have pipeline runs with the reworked pipeline. The first pipeline run includes the logic of SBRP validation tests as they exist in this PR (Generate and validation tests). The second pipeline run runs the tests as they currently exist in main (just the Generate tests).
|
|
I see. So you chose to skip all the tests that aren't supported on Windows. I'm fine with that. My biggest concern was that you would need to disable the existing generate script tests on Windows.
That's the reason: > Since they are testing two different components of the repo That said, I'm fine with your proposal given in its current form. I'm just not convinced that this is a good long term strategy. As an example, if I would want to add tests for this msbuild task, I would not put them into this single test project as such tests would depend on msbuild and NuGet APIs. This is a different component.
|
|
@ViktorHofer Thanks for your input; you bring up valid arguments for why there should be two test projects. However, after discussing this in more depth with @MichaelSimons, we've decided to stick with a single test project implementation as it exists in this PR given the current state of this repo. |
2368a2e to
417c995
Compare
|
This will fail until the arcade sdk from dotnet/installer#17985 is merged in due to the change of the inner clone path. Until then, here is a success run with these changes: https://dev.azure.com/dnceng/internal/_build/results?buildId=2336530&view=results |
| <!-- xUnit dependencies --> | ||
| <XunitSkippableFactVersion>1.4.13</XunitSkippableFactVersion> |
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.
It's absolutely fine to use SkippableFact here (as you don't want to run these tests in source build without prebuilts). Just wanted to let you know that we already have in-built support for this and more in Arcade via Microsoft.DotNet.XUnitExtensions.
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.
This is great to know! Thanks for pointing this out.
MichaelSimons
left a comment
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.
Looks good, One minor comment.
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.
The file name feels a little odd to me. Any reason it can be simplified to SbrpTests.csproj?
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.
The .Tests project name suffix is important in order for Arcade to recognize the project as a test project: https://github.com/dotnet/arcade/blob/3531486ae4b4e78149d815d99db3d3a0e8a3c64d/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props#L16
That said, SBRP.Tests.csproj would also work.
Closes dotnet/source-build#2804
Wrote tests to
The tests fail if a reference package is missing the SBRP attribute or if any package is signed