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

Restore airflow_local_settings after the test_should_use_configured_log_name #38722

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

Taragolis
Copy link
Contributor

@Taragolis Taragolis commented Apr 3, 2024

This test add some side effect for all tests after it, as result some of them might fail with "random" error

pytest tests/providers/google/cloud/log/test_stackdriver_task_handler.py::test_should_use_configured_log_name tests/providers/google/common

...

FAILED tests/providers/google/common/hooks/test_discovery_api.py::TestGoogleDiscoveryApiHook::test_get_conn - google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
======================================================= 1 failed, 83 passed, 2 skipped, 4 warnings in 10.72s =======================================================
Compute Engine Metadata server unavailable on attempt 1 of 3. Reason: [Errno 111] Connection refused
Compute Engine Metadata server unavailable on attempt 2 of 3. Reason: [Errno 111] Connection refused
Compute Engine Metadata server unavailable on attempt 3 of 3. Reason: [Errno 111] Connection refused
Authentication failed using Compute Engine authentication due to unavailable metadata server.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/logging/__init__.py", line 2127, in shutdown
    h.close()
  File "/opt/airflow/airflow/providers/google/cloud/log/stackdriver_task_handler.py", line 385, in close
    self._transport.flush()
  File "/usr/local/lib/python3.8/functools.py", line 967, in __get__
    val = self.func(instance)
  File "/opt/airflow/airflow/providers/google/cloud/log/stackdriver_task_handler.py", line 156, in _transport
    return self.transport_type(self._client, self.gcp_log_name)  # type: ignore[call-arg]
  File "/opt/airflow/airflow/providers/google/cloud/log/stackdriver_task_handler.py", line 133, in _client
    credentials, project = self._credentials_and_project
  File "/usr/local/lib/python3.8/functools.py", line 967, in __get__
    val = self.func(instance)
  File "/opt/airflow/airflow/providers/google/cloud/log/stackdriver_task_handler.py", line 125, in _credentials_and_project
    credentials, project = get_credentials_and_project_id(
  File "/opt/airflow/airflow/providers/google/cloud/utils/credentials_provider.py", line 362, in get_credentials_and_project_id
    return _CredentialProvider(*args, **kwargs).get_credentials_and_project()
  File "/opt/airflow/airflow/providers/google/cloud/utils/credentials_provider.py", line 243, in get_credentials_and_project
    credentials, project_id = self._get_credentials_using_adc()
  File "/opt/airflow/airflow/providers/google/cloud/utils/credentials_provider.py", line 348, in _get_credentials_using_adc
    credentials, project_id = google.auth.default(scopes=self.scopes)
  File "/usr/local/lib/python3.8/site-packages/google/auth/_default.py", line 691, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@Taragolis Taragolis added full tests needed We need to run full set of tests for this PR to merge all versions If set, the CI build will be forced to use all versions of Python/K8S/DBs labels Apr 3, 2024
@Taragolis Taragolis requested a review from potiuk April 3, 2024 17:27
@boring-cyborg boring-cyborg bot added area:logging area:providers provider:google Google (including GCP) related issues labels Apr 3, 2024
Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

I arrived at almost the same solution :)

@Taragolis Taragolis merged commit 40c70e3 into main Apr 3, 2024
90 checks passed
@Taragolis Taragolis deleted the restore-local-settings-after-stackdriver-test branch April 3, 2024 19:25
idantepper pushed a commit to idantepper/airflow that referenced this pull request Apr 3, 2024
idantepper pushed a commit to idantepper/airflow that referenced this pull request Apr 3, 2024
mathiaHT pushed a commit to mathiaHT/airflow that referenced this pull request Apr 4, 2024
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all versions If set, the CI build will be forced to use all versions of Python/K8S/DBs area:logging area:providers full tests needed We need to run full set of tests for this PR to merge provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants