-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Feature/add retry to gcp auth #28475
Merged
johnjcasey
merged 51 commits into
apache:master
from
johnjcasey:feature/add-retry-to-gcp-auth
Sep 27, 2023
Merged
Changes from 43 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
c22b8c1
Update 2.50 release notes to include new Kafka topicPattern feature
johnjcasey f7cf5de
Merge remote-tracking branch 'origin/master'
johnjcasey ab68ecb
Merge remote-tracking branch 'origin/master'
johnjcasey 40ad1d5
Merge remote-tracking branch 'origin/master'
johnjcasey 6c9c28d
Create groovy class for io performance tests
johnjcasey 520c9d1
delete unnecessary class
johnjcasey 062de23
fix env call
johnjcasey 01fc25b
Merge pull request #181 from johnjcasey/feature/automate-performance-…
johnjcasey 9c9f86b
fix call to gradle
johnjcasey 92306fa
Merge pull request #182 from johnjcasey/feature/automate-performance-…
johnjcasey 925ce55
run on hosted runner for testing
johnjcasey 2dcfb70
Merge pull request #183 from johnjcasey/feature/automate-performance-…
johnjcasey 117ef8b
add additional checkout
johnjcasey 1f73cda
Merge pull request #184 from johnjcasey/feature/automate-performance-…
johnjcasey cb6e01b
add destination for triggered tests
johnjcasey a9e86aa
Merge pull request #185 from johnjcasey/feature/automate-performance-…
johnjcasey 8ea6c51
move env variables to correct location
johnjcasey d8822d7
Merge pull request #186 from johnjcasey/feature/automate-performance-…
johnjcasey 320a4cc
try uploading against separate dataset
johnjcasey e89b59e
Merge pull request #187 from johnjcasey/feature/automate-performance-…
johnjcasey 1cd4e55
try without a user
johnjcasey 4473f17
Merge pull request #188 from johnjcasey/feature/automate-performance-…
johnjcasey 4fc5b8e
update branch checkout, try to view the failure log
johnjcasey 706650d
Merge pull request #189 from johnjcasey/feature/automate-performance-…
johnjcasey 59069f2
run on failure
johnjcasey 7f79b62
Merge pull request #190 from johnjcasey/feature/automate-performance-…
johnjcasey 6f51976
update to use correct BigQuery instance
johnjcasey e95d920
Merge pull request #191 from johnjcasey/feature/automate-performance-…
johnjcasey df716cb
convert to matrix
johnjcasey 4d8eded
Merge pull request #192 from johnjcasey/feature/automate-performance-…
johnjcasey 4bf0826
add result reporting
johnjcasey 403f054
Merge pull request #193 from johnjcasey/feature/automate-performance-…
johnjcasey d40d04b
add failure clause
johnjcasey aca4b2e
Merge pull request #194 from johnjcasey/feature/automate-performance-…
johnjcasey 2739e92
remove failure clause, update to run on self-hosted
johnjcasey bd6efeb
address comments, clean up build
johnjcasey 226a655
clarify branching
johnjcasey 9c7286b
Merge pull request #195 from johnjcasey/feature/automate-performance-…
johnjcasey c63f112
Update auth to retry getting credentials from GCE
johnjcasey 5b1b2c2
Merge branch 'apache:master' into master
johnjcasey 864ce98
Merge remote-tracking branch 'origin/master' into feature/add-retry-t…
johnjcasey 1c51395
Re-order imports
johnjcasey 1bacada
Add test case
johnjcasey 8eca7d0
Update exception log
johnjcasey 59310a2
Add failure test
johnjcasey 0da1faa
Update removal of retrying method
johnjcasey e7e66f2
rework via mock
johnjcasey a54cd14
Clear credentials cache for idempotent tests
johnjcasey aceae65
Remove handler after test
johnjcasey 9bd54a7
Change retry timeout to facilitate shorter retrys for anonymous acces…
johnjcasey e4a9746
reset credentials before and after test
johnjcasey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import unittest | ||
|
||
import mock | ||
|
||
from apache_beam.internal.gcp import auth | ||
from apache_beam.options.pipeline_options import GoogleCloudOptions | ||
from apache_beam.options.pipeline_options import PipelineOptions | ||
|
||
try: | ||
import google.auth as gauth | ||
except ImportError: | ||
gauth = None | ||
|
||
|
||
@unittest.skipIf(gauth is None, 'Google Auth dependencies are not installed') | ||
class MyTestCase(unittest.TestCase): | ||
@mock.patch('google.auth.default') | ||
def test_auth_with_retrys(self, unused_mock_arg): | ||
pipeline_options = PipelineOptions() | ||
pipeline_options.view_as( | ||
GoogleCloudOptions).impersonate_service_account = False | ||
|
||
credentials = ('creds', 1) | ||
|
||
self.is_called = False | ||
|
||
def side_effect(scopes=None): | ||
if self.is_called: | ||
return credentials | ||
else: | ||
self.is_called = True | ||
raise IOError('Failed') | ||
|
||
google_auth_mock = mock.MagicMock() | ||
gauth.default = google_auth_mock | ||
google_auth_mock.side_effect = side_effect | ||
|
||
returned_credentials = auth.get_service_credentials(pipeline_options) | ||
|
||
self.assertEqual('creds', returned_credentials._google_auth_credentials) | ||
johnjcasey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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.
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 am not sure we need to change this to error since connecting anonymously is allowed. And can we also make the message much clearer? e.g, Unable to find default credentials to use: %s\n, Connecting anonymously. This is expected if no credentials are required to access GCP resources.