add sb test for runtime packs in self-contained publish#16783
add sb test for runtime packs in self-contained publish#16783MichaelSimons merged 7 commits intodotnet:mainfrom
Conversation
MichaelSimons
left a comment
There was a problem hiding this comment.
Have you validated the test fails if the packages are not bundled into the SDK?
Yes, I have, but only locally / in Codespaces, have not done that in CI |
|
FYI @tmds |
1ea4209 to
883988a
Compare
883988a to
c63dd8b
Compare
c63dd8b to
6bb37ee
Compare
MichaelSimons
left a comment
There was a problem hiding this comment.
I like the simplicity of this approach and the flexibility it adds to do custom validation down the road.
| Assert.True("[]" == restoredPackageFiles, failMessage); | ||
| } else | ||
| { | ||
| throw new NugetCacheParseException(); |
There was a problem hiding this comment.
I don't think this warrants a new exception type. The primary reason is that nobody needs a specific type to catch. Additionally instead of incurring the overhead of throwing an exception, consider utilizing an Assert.
There was a problem hiding this comment.
I normally try to utilize custom exceptions as they allow for distinguishing between test failures reported by asserts and some preparation logic like parsing an input file.
But I do agree it creates overhead and is a bit too complicated for this case. Removed
Resolves dotnet/source-build#3485
Added test for source of runtime packs used in a self-contained publish.
The test creates a new project from the WebApp template (since this template would have dependency on both runtime packs currently distributed with the SDK) and does a self-contained publish. For the publish it will direct NuGet to use an empty cache. If the runtime packs are pulled from NuGet, they will end up in the cache, failing the test