-
Notifications
You must be signed in to change notification settings - Fork 206
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
Implement User-Agent spec for transport #1518
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
This commit implements the User-Agent feature. Update User-Agent sent by the agent to match the spec. HttpClient parses apm-agent-dotnet/<version> (<service> <version>) as two separate User-Agent header values, apm-agent-dotnet/<version> (<service> <version>) - Refactor outcome steps to use ScenarioContext. - Introduce TestConfiguration to allow configuration to be provided a step at a time. - Collect all payloads sent to mock HttpMessageHandler.
…/apm-agent-dotnet into update-spec-files-20211012142323
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.
LGTM
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System; |
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.
using System; |
[When("^service name is set to '(.*?)'$")] | ||
public void WhenServiceNameIsSetTo(string name) | ||
{ | ||
var configuration = _scenarioContext.Get<TestConfiguration>(); |
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.
A bit sad we can't just use Elastic.Apm.Tests.Utilities.MockConfiguration
here.
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.
MockConfiguration would require some work to factor it for usage here. I'm thinking
- Remove the parsing functions used in MockConfiguration, and test them separately
- Add public setters to the existing public properties
- Change the constructor to be parameterless and initialize field members with their default values
I considered making those changes for this PR, but it felt like they would be large enough to open a separate PR for.
|
||
namespace Elastic.Apm.Feature.Tests | ||
{ | ||
public class TestConfiguration : IConfiguration |
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.
Maybe we can move this into Elastic.Apm.Tests.Utilities
- as long as we only use it here, it's totally fine at this place as well...
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 think keeping it here for now is reasonable, and look to refactor MockConfiguration
to replace this
What
APM agent specs automatic sync
Why
Changeset
Closes #1517