You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:49:30 UTC
[GitHub] [airflow] deedmitrij opened a new pull request #19014: Fix Cloud SQL system tests
deedmitrij opened a new pull request #19014:
URL: https://github.com/apache/airflow/pull/19014
- Add creation of Fine-grained bucket for ACLs
- Add patching of environment variables
- Add unique postfix to instances names
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk merged pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #19014:
URL: https://github.com/apache/airflow/pull/19014
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r744308801
##########
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()
+@pytest.fixture(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:
I think it's good to merge. I know @deedmitrij works on automation and having the change going in this direction is an improvement (and cloud SQL is VERY annoying for system tests so any improvement there is good).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] deedmitrij commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
deedmitrij commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r742935551
##########
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()
+@pytest.fixture(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:
But it's important change to have the working test. Currently, we are working on new automation process, so anyway we will have inconsistent tests with the rest. But we need to have this working test for now at first, so, please, pay attention again to this changes and I'll appreciate if you merge them.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] deedmitrij commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
deedmitrij commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r730077161
##########
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()
+@pytest.fixture(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:
@mik-laj I know. Main reason of this change is to have possibility to run whole **test_cloud_sql_system.py** file with tests as it is. With existed logic you can't do it, because instance name for each test in this file should be unique and you can't provide this uniqueness even manually set up environment variables. That's why I've added the fixture which generates unique postfix and add it to instances names.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
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()
+@pytest.fixture(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()
+@pytest.fixture(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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#issuecomment-962673590
wdyt @mik-laj ? Are you ok with merging it?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r739415808
##########
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()
+@pytest.fixture(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:
I think we can think about changing this when we automate these tests. For now, I would prefer the code to be consistent with the rest. This makes it easier to maintain when we don't need to support several styles of running tests/settings variables.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#issuecomment-962671812
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] deedmitrij commented on a change in pull request #19014: Fix Cloud SQL system tests
Posted by GitBox <gi...@apache.org>.
deedmitrij commented on a change in pull request #19014:
URL: https://github.com/apache/airflow/pull/19014#discussion_r730626517
##########
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()
+@pytest.fixture(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:
Easy way to do it is just directly in test.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org