-
Notifications
You must be signed in to change notification settings - Fork 2.1k
test: fixing issue realted to test indentation #2786
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nmn3m The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
||
for _, l := range lines { | ||
trimmedLine = strings.TrimSpace(l) | ||
trimmedLine = strings.TrimLeft(l, " \t") |
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.
why do we need to check for tabs as well? Could we only do spaces?
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 went with strings.TrimLeft(l, " \t")
instead of just " "
because when I only trimmed spaces, a lot of tests failed. Using both spaces and tabs handled the mixed indentation and fixed the test failures.
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.
Can we fix the indentation instead to only use spaces or won't that work?
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 tried to fix the indentation using the white spaces, and the tests failed.
I think using the combination between white spaces and tab will be a good choice in that case.
What this PR does / why we need it:
This PR fixes an issue where test files contained inconsistent indentation (spaces and tabs) that were not caught by linting.
We now normalize leading whitespace in test parsing by using:
Additionally, some failing tests were updated to align with the corrected logic.
How does this change affect the cardinality of KSM:
does not change cardinality
Which issue(s) this PR fixes:
Fixes #2776