@@ -240,3 +240,65 @@ def test_standalone_dag_processor_explicit(self, airflow_version, enabled):
240
240
cfg = jmespath .search ('data."airflow.cfg"' , docs [0 ])
241
241
expected_line = f"standalone_dag_processor = { str (enabled ).lower ()} "
242
242
assert expected_line in cfg .splitlines ()
243
+
244
+ @pytest .mark .parametrize (
245
+ "airflow_version, base_url, execution_api_server_url, expected_execution_url" ,
246
+ [
247
+ (
248
+ "3.0.0" ,
249
+ None ,
250
+ None ,
251
+ "http://release-name-api-server:8080/execution" ,
252
+ ),
253
+ (
254
+ "2.9.0" ,
255
+ None ,
256
+ None ,
257
+ None ,
258
+ ),
259
+ (
260
+ "3.0.0" ,
261
+ "http://example.com" ,
262
+ None ,
263
+ "http://release-name-api-server:8080/execution" ,
264
+ ),
265
+ (
266
+ "3.0.0" ,
267
+ "http://example.com/airflow" ,
268
+ None ,
269
+ "http://release-name-api-server:8080/airflow/execution" ,
270
+ ),
271
+ (
272
+ "3.0.0" ,
273
+ "http://example.com/airflow" ,
274
+ "http://service:9090/execution/" ,
275
+ "http://service:9090/execution/" ,
276
+ ),
277
+ ],
278
+ )
279
+ def test_execution_api_server_url (
280
+ self , airflow_version , base_url , execution_api_server_url , expected_execution_url
281
+ ):
282
+ config_overrides = {}
283
+ if base_url :
284
+ config_overrides ["api" ] = {"base_url" : base_url }
285
+
286
+ if execution_api_server_url :
287
+ config_overrides ["core" ] = {"execution_api_server_url" : execution_api_server_url }
288
+
289
+ configmap = render_chart (
290
+ values = {"airflowVersion" : airflow_version , "config" : config_overrides },
291
+ show_only = ["templates/configmaps/configmap.yaml" ],
292
+ )
293
+
294
+ # config is the jmespath search for the data["airflow.cfg"] in the configmap
295
+ config = jmespath .search ('data.["airflow.cfg"]' , configmap [0 ])
296
+ assert config is not None , "Configmap data for airflow.cfg should not be None"
297
+ assert len (config ) > 0 , "Configmap data for airflow.cfg should not be empty"
298
+
299
+ if expected_execution_url is not None :
300
+ assert f"\n execution_api_server_url = { expected_execution_url } " in config [0 ]
301
+ else :
302
+ assert "execution_api_server_url" not in config [0 ], (
303
+ "execution_api_server_url should not be set for Airflow 2.x versions"
304
+ )
0 commit comments