36
36
# pdb=1 Drops you into debug mode upon test failure, if running tests.
37
37
# test= Only runs tests in the directories provided here, e.g.
38
38
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
39
+ # sql= Overrides the default SQL connection string.
39
40
40
41
41
42
# Set optional argument defaults
@@ -49,6 +50,12 @@ ifndef test
49
50
test=repos/delphi/delphi-epidata/tests repos/delphi/delphi-epidata/integrations
50
51
endif
51
52
53
+ ifdef sql
54
+ sqlalchemy_uri:=$(sql)
55
+ else
56
+ sqlalchemy_uri:=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
57
+ endif
58
+
52
59
SHELL: =/bin/sh
53
60
54
61
# Get the Makefile's absolute path: https://stackoverflow.com/a/324782/4784655
78
85
79
86
@# Run the web server
80
87
@docker run --rm -p 127.0.0.1:10080:80 \
81
- --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata " \
88
+ --env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri) " \
82
89
--env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \
83
90
--network delphi-net --name delphi_web_epidata \
84
91
delphi_web_epidata >$(LOG_WEB) 2>&1 &
@@ -123,7 +130,7 @@ test:
123
130
@docker run -i --rm --network delphi-net \
124
131
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
125
132
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
126
- --env " SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata " \
133
+ --env " SQLALCHEMY_DATABASE_URI=$( sqlalchemy_uri ) " \
127
134
--env " FLASK_SECRET=abc" \
128
135
delphi_web_python python -m pytest --import-mode importlib $(pdb ) $(test ) | tee test_output_$(NOW ) .log
129
136
@@ -132,7 +139,7 @@ bash:
132
139
@docker run -it --rm --network delphi-net \
133
140
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
134
141
--mount type=bind,source=$(CWD ) repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
135
- --env " SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata " \
142
+ --env " SQLALCHEMY_DATABASE_URI=$( sqlalchemy_uri ) " \
136
143
--env " FLASK_SECRET=abc" \
137
144
delphi_web_python bash
138
145
0 commit comments