7
7
8
8
from requests import Request
9
9
10
+ from azure_functions_worker .constants import ENABLE_INIT_INDEXING , \
11
+ PYTHON_ENABLE_WORKER_EXTENSIONS , PYTHON_ISOLATE_WORKER_DEPENDENCIES , \
12
+ PYTHON_ENABLE_DEBUG_LOGGING
10
13
from tests .utils .testutils_lc import (
11
14
LinuxConsumptionWebHostController
12
15
)
@@ -107,7 +110,7 @@ def test_new_protobuf(self):
107
110
ctrl .assign_container (env = {
108
111
"AzureWebJobsStorage" : self ._storage ,
109
112
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url ("NewProtobuf" ),
110
- " PYTHON_ISOLATE_WORKER_DEPENDENCIES" : "1"
113
+ PYTHON_ISOLATE_WORKER_DEPENDENCIES : "1"
111
114
})
112
115
req = Request ('GET' , f'{ ctrl .url } /api/HttpTrigger' )
113
116
resp = ctrl .send_request (req )
@@ -137,7 +140,7 @@ def test_old_protobuf(self):
137
140
ctrl .assign_container (env = {
138
141
"AzureWebJobsStorage" : self ._storage ,
139
142
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url ("OldProtobuf" ),
140
- " PYTHON_ISOLATE_WORKER_DEPENDENCIES" : "1"
143
+ PYTHON_ISOLATE_WORKER_DEPENDENCIES : "1"
141
144
})
142
145
req = Request ('GET' , f'{ ctrl .url } /api/HttpTrigger' )
143
146
resp = ctrl .send_request (req )
@@ -189,7 +192,7 @@ def test_debug_logging_enabled(self):
189
192
"AzureWebJobsStorage" : self ._storage ,
190
193
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url (
191
194
"EnableDebugLogging" ),
192
- " PYTHON_ENABLE_DEBUG_LOGGING" : "1"
195
+ PYTHON_ENABLE_DEBUG_LOGGING : "1"
193
196
})
194
197
req = Request ('GET' , f'{ ctrl .url } /api/HttpTrigger1' )
195
198
resp = ctrl .send_request (req )
@@ -218,7 +221,7 @@ def test_pinning_functions_to_older_version(self):
218
221
"AzureWebJobsStorage" : self ._storage ,
219
222
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url (
220
223
"PinningFunctions" ),
221
- " PYTHON_ISOLATE_WORKER_DEPENDENCIES" : "1" ,
224
+ PYTHON_ISOLATE_WORKER_DEPENDENCIES : "1" ,
222
225
})
223
226
req = Request ('GET' , f'{ ctrl .url } /api/HttpTrigger1' )
224
227
resp = ctrl .send_request (req )
@@ -232,8 +235,7 @@ def test_opencensus_with_extensions_enabled(self):
232
235
"""A function app with extensions enabled containing the
233
236
following libraries:
234
237
235
- azure-functions, azure-eventhub, azure-storage-blob, numpy,
236
- cryptography, pyodbc, requests
238
+ azure-functions, opencensus
237
239
238
240
should return 200 after importing all libraries.
239
241
"""
@@ -242,8 +244,25 @@ def test_opencensus_with_extensions_enabled(self):
242
244
ctrl .assign_container (env = {
243
245
"AzureWebJobsStorage" : self ._storage ,
244
246
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url ("Opencensus" ),
245
- "PYTHON_ENABLE_WORKER_EXTENSIONS" : "1" ,
246
- "AzureWebJobsFeatureFlags" : "EnableWorkerIndexing"
247
+ PYTHON_ENABLE_WORKER_EXTENSIONS : "1"
248
+ })
249
+ req = Request ('GET' , f'{ ctrl .url } /api/opencensus' )
250
+ resp = ctrl .send_request (req )
251
+ self .assertEqual (resp .status_code , 200 )
252
+
253
+ @skipIf (sys .version_info .minor != 10 ,
254
+ "This is testing only for python310" )
255
+ def test_opencensus_with_extensions_enabled_init_indexing (self ):
256
+ """
257
+ A function app with init indexing enabled
258
+ """
259
+ with LinuxConsumptionWebHostController (_DEFAULT_HOST_VERSION ,
260
+ self ._py_version ) as ctrl :
261
+ ctrl .assign_container (env = {
262
+ "AzureWebJobsStorage" : self ._storage ,
263
+ "SCM_RUN_FROM_PACKAGE" : self ._get_blob_url ("Opencensus" ),
264
+ PYTHON_ENABLE_WORKER_EXTENSIONS : "1" ,
265
+ ENABLE_INIT_INDEXING : "true"
247
266
})
248
267
req = Request ('GET' , f'{ ctrl .url } /api/opencensus' )
249
268
resp = ctrl .send_request (req )
@@ -263,8 +282,7 @@ def test_reload_variables_after_timeout_error(self):
263
282
"AzureWebJobsStorage" : self ._storage ,
264
283
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url (
265
284
"TimeoutError" ),
266
- "PYTHON_ISOLATE_WORKER_DEPENDENCIES" : "1" ,
267
- "AzureWebJobsFeatureFlags" : "EnableWorkerIndexing"
285
+ PYTHON_ISOLATE_WORKER_DEPENDENCIES : "1"
268
286
})
269
287
req = Request ('GET' , f'{ ctrl .url } /api/hello' )
270
288
resp = ctrl .send_request (req )
@@ -297,8 +315,7 @@ def test_reload_variables_after_oom_error(self):
297
315
"AzureWebJobsStorage" : self ._storage ,
298
316
"SCM_RUN_FROM_PACKAGE" : self ._get_blob_url (
299
317
"OOMError" ),
300
- "PYTHON_ISOLATE_WORKER_DEPENDENCIES" : "1" ,
301
- "AzureWebJobsFeatureFlags" : "EnableWorkerIndexing"
318
+ PYTHON_ISOLATE_WORKER_DEPENDENCIES : "1"
302
319
})
303
320
req = Request ('GET' , f'{ ctrl .url } /api/httptrigger' )
304
321
resp = ctrl .send_request (req )
0 commit comments