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

helper/logging: Adjust unit test regex flag #1224

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Jul 10, 2023

Originally found in #1223 - The unit test TestNewLoggingHTTPTransport_LogMasking started failing in a recent dependabot PR: https://github.com/hashicorp/terraform-plugin-sdk/actions/runs/5473296958/jobs/10006381743?pr=1223

The test failing is using a GET https://www.terraform.io request to test the masking for the logger on the response body, using a regex <html>.*</html> for the mask. I believe the site must have changed recently and introduced some \n characters, because . in RE2 regex does not match \n characters by default: https://github.com/google/re2/blob/a57a1d6462a1613e5e2cfd6fb1ce26d36706a9af/doc/syntax.txt#L68

Adjusting the test's regex to include that flag should fix it -> (?s)<html>.*</html>

Notes

  • Added timeout for lint

@austinvalle austinvalle requested a review from a team as a code owner July 10, 2023 12:59
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Seems okay for now. Ideally, we'd spin up our own web server to control the unit test better, but that seems like a project for when this is handled in terraform-plugin-log, rather than something to adjust here at this point.

@austinvalle
Copy link
Member Author

Seems okay for now. Ideally, we'd spin up our own web server to control the unit test better, but that seems like a project for when this is handled in terraform-plugin-log, rather than something to adjust here at this point.

Agreed 😆

@austinvalle austinvalle merged commit 60e8641 into main Jul 13, 2023
@austinvalle austinvalle deleted the av/fix-test-regex branch July 13, 2023 18:01
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants