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

[Test Proxy] Add RecordedByProxy decorator and AzureRecordedTestCase #20138

Merged
merged 12 commits into from
Aug 17, 2021

Conversation

mccoyp
Copy link
Member

@mccoyp mccoyp commented Aug 7, 2021

Merges in tools from the integrate-proxy branch so that SDKs can begin migrating tests to the test proxy.

@mccoyp mccoyp requested a review from scbedd August 7, 2021 00:04
# TODO, get the test-proxy server a real SSL certificate. The issue here is that SSL Certificates are
# normally associated with a domain name. Need to talk to the //SSLAdmin folks (or someone else) and get
# a recommendation for how to get a valid SSL Cert for localhost
kwargs["connection_verify"] = False
Copy link
Member

Choose a reason for hiding this comment

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

As discussed. I'll help figure out the trust methodology for the certificate. We should remove this before we merge.

from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function

# defaults
PROXY_URL = "http://localhost:5000"
Copy link
Member

Choose a reason for hiding this comment

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

If we're ok with manual start of the proxy, we should probably assume SSL. I'll see if I can figure that out today. If I can, let's get those changes added to this PR and swap this to https.

@mccoyp
Copy link
Member Author

mccoyp commented Aug 12, 2021

/check-enforcer reset

Copy link
Member

@seankane-msft seankane-msft left a comment

Choose a reason for hiding this comment

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

LGTM, two small comments

Comment on lines +138 to +140
# Adding this for new proxy testcase
if hasattr(test_class_instance, "scrubber"):
test_class_instance.scrubber.register_name_pair(resource_name, self.moniker)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would add a log as an else statement here because then the name pair will not be scrubbed from the recordings. With a log at least you are notifying the dev that the object has no scrubber object.

Comment on lines +68 to +72
# Adding this for new proxy testcase
if hasattr(self.test_class_instance, "scrubber"):
self.test_class_instance.scrubber.register_name_pair(
self.real_values[key.lower()], scrubbed_value
)
Copy link
Member

Choose a reason for hiding this comment

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

same as above, might just break out into a small helper function

return os.sep.join(path_components).replace("::", "").replace("\\", "/")


def get_current_sha():
Copy link
Member

@scbedd scbedd Aug 17, 2021

Choose a reason for hiding this comment

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

nit:I believe we can clean this function out.

@mccoyp mccoyp merged commit eefe01a into Azure:main Aug 17, 2021
@mccoyp mccoyp deleted the integrate-proxy-rb branch August 17, 2021 21:40
iscai-msft added a commit that referenced this pull request Aug 23, 2021
…into header_tuples

* 'main' of https://github.com/Azure/azure-sdk-for-python: (104 commits)
  [Key Vault] Add 7.3-preview support for administration (#20364)
  Fix Monitor opentelemetry exporter readme issues (#19038)
  More Renaming in query (#20303)
  Update CODEOWNERS (#20366)
  [ServiceBus] update migration guide with message count info (#20360)
  [rest] change text from a property to a method (#20290)
  Handle value types for results (#20358)
  Remove old unused update changelog script (#20357)
  bump node version (#20353)
  [AutoRelease] t2-web-2021-08-03-73015 (#20053)
  Fix query batch processing (#20345)
  Sync eng/common directory with azure-sdk-tools for PR 1912 (#20340)
  Increment version for schemaregistry releases (#20326)
  [SchemaRegistry] prepare avro for release (#20321)
  Update CHANGELOG.md (#20334)
  Update main.py (#20332)
  Removing C:\Git\azure-sdk-tools\eng\common\scripts\FilterPoliCheckResults.ps1 as it was no longer used (#20325)
  Suppress CredScan warning for test proxy devcert (#20324)
  [SchemaRegistry] update samples readme (#20323)
  [Test Proxy] Add RecordedByProxy decorator and AzureRecordedTestCase (#20138)
  ...
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.

3 participants