-
Notifications
You must be signed in to change notification settings - Fork 609
Add an option to set DCP log file name suffix based on test name #9088
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
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.
Pull Request Overview
This pull request adds an option to allow DCP log files to incorporate the test name into their suffix, making it easier to correlate logs with specific tests.
- Test program now sets the "LogFileNameSuffix" configuration based on the test name.
- DcpOptions is updated with a new nullable property and corresponding documentation.
- DcpHost now uses the new option to add an environment variable if the suffix is provided.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/testproject/TestProject.AppHost/TestProgram.cs | Adds a new configuration entry for log file suffix |
src/Aspire.Hosting/Dcp/DcpOptions.cs | Introduces the LogFileNameSuffix property and documentation |
src/Aspire.Hosting/Dcp/DcpHost.cs | Applies the new option to set an environment variable for DCP logging |
Comments suppressed due to low confidence (1)
tests/testproject/TestProject.AppHost/TestProgram.cs:57
- [nitpick] Consider adding unit or integration tests to verify that the log file name suffix is correctly propagated and applied, ensuring the expected log file naming format is maintained.
builder.Configuration["DcpPublisher:LogFileNameSuffix"] = testName;
@@ -54,6 +54,7 @@ private TestProgram( | |||
builder.Configuration["DcpPublisher:ResourceNameSuffix"] = $"{Random.Shared.Next():x}"; | |||
builder.Configuration["DcpPublisher:RandomizePorts"] = randomizePorts.ToString(CultureInfo.InvariantCulture); | |||
builder.Configuration["DcpPublisher:WaitForResourceCleanup"] = "true"; | |||
builder.Configuration["DcpPublisher:LogFileNameSuffix"] = testName; |
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.
Do we have an issue for doing this in more places?
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 do not think we do. Do you want me to open one?
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.
Yep. This is a very specific test.
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.
Created #9106 to track that work
Description
Adds a DCP option that allows DCP log names to reflect the test that launched the specific DCP instance (and leverages it for
DistributedApplicationTests
). With this change DCP log names follow the following formatfor example
dcp-12345678-proxyless-endpoint-works.log
(forproxyless-endpoint-works
test), making it very easy to correlate between test under investigation and corresponding DCP log file.The environment variable that this change is using is not effective yet with the DCP version that is integrated into Aspire, but it will become effective with the next DCP insertion.
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template