-
Notifications
You must be signed in to change notification settings - Fork 543
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
Include Executable WithArgs in manifest #1366
Conversation
} | ||
} | ||
|
||
if (args.Count > 0) |
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.
Previously if ExecutableResource.Args
was empty the "args" would be in the manifest with an empty array. I changed this to not include the args
to be consistence with Container manifest.
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.
Add a test to verify this?
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.
Done.
/// <param name="builder">The resource builder.</param> | ||
/// <param name="args">The arguments to be passed to the executable when it is started.</param> | ||
/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns> | ||
public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, params string[] args) where T : ExecutableResource |
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.
I copied this from #1363 to be able to produce the bug and write test for it.
{ | ||
context.Writer.WriteStartArray("args"); | ||
|
||
foreach (var arg in args ?? []) |
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.
args
will never be null here now right, so you can avoid the ??
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.
Done.
@@ -103,6 +103,32 @@ public void EnsureContainerWithArgsEmitsContainerArgs() | |||
arg => Assert.Equal("more", arg.GetString())); | |||
} | |||
|
|||
[Fact] | |||
public void EnsureExecutableWithArgsEmitsExecutableArgs() |
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.
Perhaps add a variant that ensures args are added via the extension method even if the resource itself had no args when defined.
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.
Done.
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 looks good.
Thanks for the contribution @Kahbazi! |
This reverts commit 0c3d014.
Fixes #1362
Microsoft Reviewers: Open in CodeFlow