mik-laj commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r730053961
##########
File path: tests/providers/google/cloud/operators/test_cloud_sql_system.py
##########
@@ -34,27 +35,98 @@
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER,
GoogleSystemTest, provide_gcp_context
GCP_PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'project-id')
+CLOUD_SQL_BUCKET_NAME = os.environ.get('CLOUD_SQL_BUCKET_NAME', 'INVALID
BUCKET NAME')
SQL_QUERY_TEST_HELPER = CloudSqlQueryTestHelper()
[email protected](scope='class')
+def env_patch():
+ """
+ A convenient fixture for environment variables patching.
+ All modifications will be undone after the requesting test class has
finished.
+ """
+ from _pytest.monkeypatch import MonkeyPatch
+ mpatch = MonkeyPatch()
Review comment:
Environment variables should only be set once when starting the Breeze
environment. The environment variables should only be set once when starting
the Breeze environment so that you can test each task one at a time and also
run a system test that will execute a full DAG.
To do it, you can create a new file in `/files/airflow-breeze-config.sh`.
See:
https://github.com/apache/airflow/blob/934b76b82bf3a0cc87f0986fc1274030bf843743/scripts/in_container/configure_environment.sh#L20
##########
File path: tests/providers/google/cloud/operators/test_cloud_sql_system.py
##########
@@ -34,27 +35,98 @@
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER,
GoogleSystemTest, provide_gcp_context
GCP_PROJECT_ID = os.environ.get('GCP_PROJECT_ID', 'project-id')
+CLOUD_SQL_BUCKET_NAME = os.environ.get('CLOUD_SQL_BUCKET_NAME', 'INVALID
BUCKET NAME')
SQL_QUERY_TEST_HELPER = CloudSqlQueryTestHelper()
[email protected](scope='class')
+def env_patch():
+ """
+ A convenient fixture for environment variables patching.
+ All modifications will be undone after the requesting test class has
finished.
+ """
+ from _pytest.monkeypatch import MonkeyPatch
+ mpatch = MonkeyPatch()
Review comment:
Why can't you provide unique names with environment variables? I think
bash can generate variables that have a random value.
https://github.com/PolideaInternal/airflow-system-tests/blob/fa563d7d4bf8bac94aff84f688cfff1910f8e82b/system_tests/set_variables.sh#L115-L127
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]