airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] mik-laj commented on a change in pull request #6761: [AIRFLOW-6204] Add GCP system tests helper
Date Wed, 01 Jan 2020 11:56:36 GMT
mik-laj commented on a change in pull request #6761: [AIRFLOW-6204] Add GCP system tests helper
URL: https://github.com/apache/airflow/pull/6761#discussion_r362318767
 
 

 ##########
 File path: TESTING.rst
 ##########
 @@ -56,6 +56,77 @@ There are a few guidelines that you should follow when writing unit tests:
 * We plann to convert all unittests to standard "asserts" semi-automatically but this will
be done later
   in Airflow 2.0 development phase. That will include setUp/tearDown/context managers and
decorators
 
+Writing system tests
+--------------------
+
+It's not necessary to add system tests. However, those tests help us to verify that everything
works as expected.
+
+One of proposed way to write system tests is to run example DAG that will use functions /
integrations you wish to
+test. To write such test u can use :class:`~tests.test_utils.system_test_class.SystemTest`
that implements two
+useful methods:
+
+- ``skip`` decorator that check if environment variable ``ENABLE_SYSTEM_TESTS=true``
+- ``run_dag`` that run an DAG by its id.
+
+Example system test:
+
+.. code-block:: python
+
+  @SystemTest.skip()
+  class TestExampleDagSystem(SystemTest):
+      def test_dag_example(self):
+          self.run_dag(dag_id="example_bash_operator")
+
+In case of more complex system test that may require interaction with 3rd party services
it's worth to create a
+custom test class. Such class may implement:
+
+- common methods used for setup and teardown of infrastructure.
+- custom ``skip`` decorator
+
+For example :class:`~tests.test_utils.gcp_system_helpers.GcpSystemTest` implements methods
that allow a developer
+to create and delete GCS buckets.
+
+Moreover, if a test requires time consuming setup or teardown it's recommend to add simple
cli. This helps a
 
 Review comment:
   ```suggestion
   Moreover, if a test requires time consuming setup or teardown it's recommend to add simple
CLI. This helps a
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message