Repository navigation
Conversation
RetrieveNodePortIp() and RetrieveLoadBalancerIp() raised plain strings when the kubectl lookup came back empty, which Python 3 turns into "TypeError: exceptions must derive from BaseException" and hides the real cause. Raise errors.Config.InvalidValue like the validation paths in the same functions already do, and drop the pyrefly suppressions that were masking it. Fixes GoogleCloudPlatform#7182.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7182.
RetrieveNodePortIp()andRetrieveLoadBalancerIp()inperfkitbenchmarker/beam_pipeline_options.pyraised a bare string whenkubernetes_commands.GetWithWaitForContents()came back empty. Python 3 cannot raise a string, so the failure surfaced asTypeError: exceptions must derive from BaseExceptioninstead of the intended message, with nothing identifying which dynamic option failed. Both call sites were silenced with# pyrefly: ignore[bad-raise], which is why the type checker never flagged them.This changes both paths to raise
errors.Config.InvalidValue, which is already what the adjacent validation in the same two functions raises for a missing selector or service name. The suppressions are removed.tests/linux_benchmarks/beam_integration_benchmark_test.py. Each mocks the kubectl lookup to return an empty string and asserts the exception type and message. Both fail withTypeErroragainst the previous code and pass with this change.pyink --checkon the touched files andlint-diffsover the added lines both pass locally.CHANGES.next.mdhas an entry under "Bug fixes and maintenance updates", per CONTRIBUTING.md.