Commit 8d77e3e 1 parent 6f83354 commit 8d77e3e Copy full SHA for 8d77e3e
File tree 6 files changed +27
-4
lines changed
6 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,11 @@ set -exuo pipefail
20
20
21
21
MYSQL_HOST=mysql
22
22
23
- mysql -h ${MYSQL_HOST} -u root -e ' drop database if exists airflow; create database airflow'
23
+ retries=3
24
+ for (( i= 0 ; i< retries; i++ )) ; do
25
+ mysql -h ${MYSQL_HOST} -u root -e ' drop database if exists airflow; create database airflow' && exit 0
26
+ echo " mysql db creation did not succeed, waiting 5 seconds to retry"
27
+ sleep 5
28
+ done
29
+
30
+ echo " mysql db creation could not succeed" && exit 1
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ airflow_home = ~/airflow
21
21
dags_folder = ~/airflow/dags
22
22
base_log_folder = ~/airflow/logs
23
23
executor = LocalExecutor
24
- sql_alchemy_conn = mysql://root@mysql/airflow
24
+ sql_alchemy_conn = # overridden by tox.ini
25
25
unit_test_mode = True
26
26
load_examples = True
27
27
donot_pickle = False
@@ -56,7 +56,7 @@ celery_app_name = airflow.executors.celery_executor
56
56
worker_concurrency = 16
57
57
worker_log_server_port = 8793
58
58
broker_url = amqp://guest:guest@rabbitmq:5672/
59
- result_backend = db+mysql://root@mysql/airflow
59
+ result_backend = # overridden by tox.ini
60
60
flower_port = 5555
61
61
default_queue = default
62
62
sync_parallelism = 0
Original file line number Diff line number Diff line change @@ -191,4 +191,9 @@ def test_deprecated_options_cmd(self):
191
191
conf .set ('celery' , 'celery_result_backend_cmd' , '/bin/echo 99' )
192
192
193
193
with self .assertWarns (DeprecationWarning ):
194
+ tmp = None
195
+ if 'AIRFLOW__CELERY__RESULT_BACKEND' in os .environ :
196
+ tmp = os .environ .pop ('AIRFLOW__CELERY__RESULT_BACKEND' )
194
197
self .assertEquals (conf .getint ('celery' , 'result_backend' ), 99 )
198
+ if tmp :
199
+ os .environ ['AIRFLOW__CELERY__RESULT_BACKEND' ] = tmp
Original file line number Diff line number Diff line change 26
26
from airflow .executors .celery_executor import CELERY_FETCH_ERR_MSG_HEADER
27
27
from airflow .utils .state import State
28
28
29
+ from airflow import configuration
30
+ configuration .load_test_config ()
31
+
29
32
# leave this it is used by the test worker
30
33
import celery .contrib .testing .tasks # noqa: F401
31
34
32
35
33
36
class CeleryExecutorTest (unittest .TestCase ):
37
+ @unittest .skipIf ('sqlite' in configuration .conf .get ('core' , 'sql_alchemy_conn' ),
38
+ "sqlite is configured with SequentialExecutor" )
34
39
def test_celery_integration (self ):
35
40
executor = CeleryExecutor ()
36
41
executor .start ()
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ def setUp(self):
38
38
}
39
39
self .dag = DAG (TEST_DAG_ID , default_args = args )
40
40
41
+ @unittest .skipUnless ('mysql' in configuration .conf .get ('core' , 'sql_alchemy_conn' ),
42
+ "this is a mysql test" )
41
43
def test_sql_sensor_mysql (self ):
42
44
t = SqlSensor (
43
45
task_id = 'sql_sensor_check' ,
@@ -47,6 +49,8 @@ def test_sql_sensor_mysql(self):
47
49
)
48
50
t .run (start_date = DEFAULT_DATE , end_date = DEFAULT_DATE , ignore_ti_state = True )
49
51
52
+ @unittest .skipUnless ('postgresql' in configuration .conf .get ('core' , 'sql_alchemy_conn' ),
53
+ "this is a postgres test" )
50
54
def test_sql_sensor_postgres (self ):
51
55
t = SqlSensor (
52
56
task_id = 'sql_sensor_check' ,
Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ setenv =
48
48
KRB5_CONFIG =/etc/krb5.conf
49
49
KRB5_KTNAME =/etc/airflow.keytab
50
50
backend_mysql: AIRFLOW__CORE__SQL_ALCHEMY_CONN =mysql://root@mysql/airflow
51
+ backend_mysql: AIRFLOW__CELERY__RESULT_BACKEND =db+mysql://root@mysql/airflow
51
52
backend_postgres: AIRFLOW__CORE__SQL_ALCHEMY_CONN =postgresql+psycopg2://postgres:airflow@postgres/airflow
53
+ backend_postgres: AIRFLOW__CELERY__RESULT_BACKEND =db+postgresql://postgres:airflow@postgres/airflow
52
54
backend_sqlite: AIRFLOW__CORE__SQL_ALCHEMY_CONN =sqlite:///{homedir}/airflow.db
53
55
backend_sqlite: AIRFLOW__CORE__EXECUTOR =SequentialExecutor
54
56
@@ -59,7 +61,7 @@ commands =
59
61
pip install --progress-bar off --find-links ={homedir}/.wheelhouse --no-index -e .[devel_ci]
60
62
env_docker: {toxinidir}/scripts/ci/1-setup-env.sh
61
63
env_docker: {toxinidir}/scripts/ci/2-setup-kdc.sh
62
- env_docker : {toxinidir}/scripts/ci/3-setup-databases .sh
64
+ backend_mysql : {toxinidir}/scripts/ci/3-setup-mysql .sh
63
65
{toxinidir}/scripts/ci/5-run-tests.sh []
64
66
{toxinidir}/scripts/ci/6-check-license.sh
65
67
codecov -e TOXENV
You can’t perform that action at this time.
0 commit comments