Adding missing inits to correct binding load (#1354)
This commit is contained in:
Родитель
a86adb4271
Коммит
7a4635cf9b
|
@ -103,6 +103,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
mode (Linux Consumption)
|
||||
"""
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Reload environment variable on specialization
|
||||
|
@ -155,6 +156,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
os.environ.update({PYTHON_THREADPOOL_THREAD_COUNT: 'invalid'})
|
||||
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
await self._assert_workers_threadpool(self._ctrl, host,
|
||||
self._default_workers)
|
||||
|
@ -169,6 +171,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
# Configure thread pool max worker to an invalid value
|
||||
os.environ.update({PYTHON_THREADPOOL_THREAD_COUNT: '0'})
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
await self._assert_workers_threadpool(self._ctrl, host,
|
||||
self._default_workers)
|
||||
|
@ -187,6 +190,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
os.environ.update({PYTHON_THREADPOOL_THREAD_COUNT:
|
||||
f'{self._over_max_workers}'})
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker('4.15.1')
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Ensure the dispatcher sync threadpool should fallback to max
|
||||
|
@ -198,6 +202,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
mode (Linux Consumption)
|
||||
"""
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Reload environment variable on specialization
|
||||
|
@ -213,6 +218,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
"""
|
||||
with patch('azure_functions_worker.dispatcher.logger') as mock_logger:
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Reload environment variable on specialization
|
||||
|
@ -234,6 +240,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
"""
|
||||
with patch('azure_functions_worker.dispatcher.logger'):
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Reload environment variable on specialization
|
||||
|
@ -249,6 +256,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
"""
|
||||
with patch('azure_functions_worker.dispatcher.logger') as mock_logger:
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
||||
# Reload environment variable on specialization
|
||||
|
@ -268,6 +276,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
async def test_sync_invocation_request_log(self):
|
||||
with patch('azure_functions_worker.dispatcher.logger') as mock_logger:
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
request_id: str = self._ctrl._worker._request_id
|
||||
func_id, invoke_id, func_name = (
|
||||
await self._check_if_function_is_ok(host)
|
||||
|
@ -286,6 +295,7 @@ class TestThreadPoolSettingsPython37(testutils.AsyncTestCase):
|
|||
async def test_async_invocation_request_log(self):
|
||||
with patch('azure_functions_worker.dispatcher.logger') as mock_logger:
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
request_id: str = self._ctrl._worker._request_id
|
||||
func_id, invoke_id, func_name = (
|
||||
await self._check_if_async_function_is_ok(host)
|
||||
|
@ -543,6 +553,7 @@ class TestDispatcherStein(testutils.AsyncTestCase):
|
|||
when a functions metadata request is received
|
||||
"""
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
r = await host.get_functions_metadata()
|
||||
self.assertIsInstance(r.response, protos.FunctionMetadataResponse)
|
||||
self.assertFalse(r.response.use_default_metadata_indexing)
|
||||
|
@ -554,6 +565,7 @@ class TestDispatcherStein(testutils.AsyncTestCase):
|
|||
when a functions metadata request is received
|
||||
"""
|
||||
async with self._ctrl as host:
|
||||
await host.init_worker()
|
||||
r = await host.get_functions_metadata()
|
||||
self.assertIsInstance(r.response, protos.FunctionMetadataResponse)
|
||||
self.assertFalse(r.response.use_default_metadata_indexing)
|
||||
|
@ -609,7 +621,7 @@ class TestDispatcherInitRequest(testutils.AsyncTestCase):
|
|||
"""Test if azure functions is loaded during init
|
||||
"""
|
||||
async with self._ctrl as host:
|
||||
r = await host.init_worker('4.15.1')
|
||||
r = await host.init_worker()
|
||||
self.assertEqual(
|
||||
len([log for log in r.logs if log.message.startswith(
|
||||
'Received WorkerInitRequest'
|
||||
|
@ -625,7 +637,7 @@ class TestDispatcherInitRequest(testutils.AsyncTestCase):
|
|||
|
||||
# Dedicated Apps where placeholder mode is not set
|
||||
async with self._ctrl as host:
|
||||
r = await host.init_worker('4.15.1')
|
||||
r = await host.init_worker()
|
||||
logs = [log.message for log in r.logs]
|
||||
self.assertIn(
|
||||
"Applying prioritize_customer_dependencies: "
|
||||
|
@ -643,7 +655,7 @@ class TestDispatcherInitRequest(testutils.AsyncTestCase):
|
|||
os.environ["CONTAINER_NAME"] = "test"
|
||||
os.environ["WEBSITE_PLACEHOLDER_MODE"] = "1"
|
||||
async with self._ctrl as host:
|
||||
r = await host.init_worker('4.15.1')
|
||||
r = await host.init_worker()
|
||||
logs = [log.message for log in r.logs]
|
||||
self.assertNotIn(
|
||||
"Applying prioritize_customer_dependencies: "
|
||||
|
@ -660,7 +672,7 @@ class TestDispatcherInitRequest(testutils.AsyncTestCase):
|
|||
os.environ["WEBSITE_PLACEHOLDER_MODE"] = "0"
|
||||
os.environ["CONTAINER_NAME"] = "test"
|
||||
async with self._ctrl as host:
|
||||
r = await host.init_worker('4.15.1')
|
||||
r = await host.init_worker()
|
||||
logs = [log.message for log in r.logs]
|
||||
self.assertIn(
|
||||
"Applying prioritize_customer_dependencies: "
|
||||
|
|
|
@ -514,7 +514,7 @@ class _MockWebHost:
|
|||
def request_id(self):
|
||||
return self._request_id
|
||||
|
||||
async def init_worker(self, host_version: str):
|
||||
async def init_worker(self, host_version: str = '4.28.0'):
|
||||
r = await self.communicate(
|
||||
protos.StreamingMessage(
|
||||
worker_init_request=protos.WorkerInitRequest(
|
||||
|
|
Загрузка…
Ссылка в новой задаче