Skip to content
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

RUMM-1350 let customer set up a Proxy for data upload #582

Merged
merged 5 commits into from
Sep 6, 2021

Conversation

xgouchet
Copy link
Contributor

@xgouchet xgouchet commented Sep 1, 2021

What and why?

Let a customer setup a custom Proxy for data intake.

How?

A new method let's the customer provide the proxy configuration dictionary that will be forwarded to the HttpClient to create the URLSession.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@xgouchet xgouchet requested a review from a team as a code owner September 1, 2021 10:36
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
I've some minor changes to make in the tests implementation: the as AnyHashable can be removed when setting the proxy parameter keys!

Comment on lines 255 to 261
let proxyConfiguration: [AnyHashable: Any] = [
kCFNetworkProxiesHTTPEnable as AnyHashable: true,
kCFNetworkProxiesHTTPPort as AnyHashable: 123,
kCFNetworkProxiesHTTPProxy as AnyHashable: "www.example.com",
kCFProxyUsernameKey as AnyHashable: "proxyuser",
kCFProxyPasswordKey as AnyHashable: "proxypass",
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All casting as AnyHashable are redundant, it is enforced by the dictionary type.
It also valid for all getter in further assertions.

Suggested change
let proxyConfiguration: [AnyHashable: Any] = [
kCFNetworkProxiesHTTPEnable as AnyHashable: true,
kCFNetworkProxiesHTTPPort as AnyHashable: 123,
kCFNetworkProxiesHTTPProxy as AnyHashable: "www.example.com",
kCFProxyUsernameKey as AnyHashable: "proxyuser",
kCFProxyPasswordKey as AnyHashable: "proxypass",
]
let proxyConfiguration: [AnyHashable: Any] = [
kCFNetworkProxiesHTTPEnable: true,
kCFNetworkProxiesHTTPPort: 123,
kCFNetworkProxiesHTTPProxy: "www.example.com",
kCFProxyUsernameKey: "proxyuser",
kCFProxyPasswordKey: "proxypass",
]

]
let configuration = try createConfiguration(proxyConfiguration: proxyConfiguration)

XCTAssertEqual(configuration.common.proxyConfiguration?[kCFNetworkProxiesHTTPEnable as AnyHashable] as? Bool, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
XCTAssertEqual(configuration.common.proxyConfiguration?[kCFNetworkProxiesHTTPEnable as AnyHashable] as? Bool, true)
XCTAssertEqual(configuration.common.proxyConfiguration?[kCFNetworkProxiesHTTPEnable] as? Bool, true)

@@ -180,6 +180,13 @@ class DDConfigurationTests: XCTestCase {
objcBuilder.set(additionalConfiguration: ["foo": 42, "bar": "something"])
XCTAssertEqual(objcBuilder.build().sdkConfiguration.additionalConfiguration["foo"] as? Int, 42)
XCTAssertEqual(objcBuilder.build().sdkConfiguration.additionalConfiguration["bar"] as? String, "something")

objcBuilder.set(proxyConfiguration: [kCFNetworkProxiesHTTPEnable as AnyHashable: true, kCFNetworkProxiesHTTPPort as AnyHashable: 123, kCFNetworkProxiesHTTPProxy as AnyHashable: "www.example.com", kCFProxyUsernameKey as AnyHashable: "proxyuser", kCFProxyPasswordKey as AnyHashable: "proxypass" ])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/nit

Suggested change
objcBuilder.set(proxyConfiguration: [kCFNetworkProxiesHTTPEnable as AnyHashable: true, kCFNetworkProxiesHTTPPort as AnyHashable: 123, kCFNetworkProxiesHTTPProxy as AnyHashable: "www.example.com", kCFProxyUsernameKey as AnyHashable: "proxyuser", kCFProxyPasswordKey as AnyHashable: "proxypass" ])
objcBuilder.set(proxyConfiguration: [
kCFNetworkProxiesHTTPEnable: true,
kCFNetworkProxiesHTTPPort: 123,
kCFNetworkProxiesHTTPProxy: "www.example.com",
kCFProxyUsernameKey: "proxyuser",
kCFProxyPasswordKey: "proxypass"
])

@ncreated ncreated added the needs-docs To mark PRs which need documentation update label Sep 2, 2021
@xgouchet xgouchet requested a review from maxep September 3, 2021 06:47
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@xgouchet xgouchet requested a review from a team as a code owner September 3, 2021 07:01
@ncreated ncreated removed the needs-docs To mark PRs which need documentation update label Sep 3, 2021
Copy link
Contributor

@sarina-dd sarina-dd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small edit suggestion, otherwise LGTM!

@xgouchet xgouchet merged commit a4fe368 into master Sep 6, 2021
@xgouchet xgouchet deleted the xgouchet/RUMM-1350/proxy branch September 12, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants