Skip to content

Commit a7b06be

Browse files
author
Victoria Hall
committed
registry flaky test
1 parent 38d145a commit a7b06be

5 files changed

+16
-6
lines changed

.github/Scripts/fwpc-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend/test_worker_process_count_functions.py tests/endtoend/test_threadpool_thread_count_functions.py
2+
python -m pytest -q -n 1 --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend/test_worker_process_count_functions.py tests/endtoend/test_threadpool_thread_count_functions.py

tests/endtoend/test_threadpool_thread_count_functions.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def setUpClass(cls):
2121

2222
def tearDown(self):
2323
os.environ.pop('PYTHON_THREADPOOL_THREAD_COUNT')
24+
2425
super().tearDown()
2526

2627
@classmethod

tests/endtoend/test_worker_process_count_functions.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class TestWorkerProcessCount(testutils.WebHostTestCase):
1414
"""
1515
@classmethod
1616
def setUpClass(cls):
17+
cls.env_variables['PYTHON_THREADPOOL_THREAD_COUNT'] = '1'
18+
cls.env_variables['FUNCTIONS_WORKER_PROCESS_COUNT'] = '2'
19+
1720
os.environ["PYTHON_THREADPOOL_THREAD_COUNT"] = "1"
1821
os.environ["FUNCTIONS_WORKER_PROCESS_COUNT"] = "2"
1922

@@ -22,6 +25,7 @@ def setUpClass(cls):
2225
def tearDown(self):
2326
os.environ.pop('PYTHON_THREADPOOL_THREAD_COUNT')
2427
os.environ.pop('FUNCTIONS_WORKER_PROCESS_COUNT')
28+
2529
super().tearDown()
2630

2731
@classmethod

tests/unittests/test_enable_debug_logging_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"""
2121

2222

23+
@testutils.retryable_test(4, 5)
2324
class TestDebugLoggingEnabledFunctions(testutils.WebHostTestCase):
2425
"""
2526
Tests for cx debug logging enabled case.
@@ -38,7 +39,6 @@ def tearDownClass(cls):
3839
def get_script_dir(cls):
3940
return testutils.UNIT_TESTS_FOLDER / 'log_filtering_functions'
4041

41-
@testutils.retryable_test(4, 5)
4242
def test_debug_logging_enabled(self):
4343
"""
4444
Verify when cx debug logging is enabled, cx function debug logs

tests/unittests/test_functions_registry.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
import unittest
4+
from tests.utils import testutils
55

66
from azure.functions import Function
77
from azure.functions.decorators.blob import BlobInput
@@ -11,17 +11,22 @@
1111
from azure_functions_worker.functions import FunctionLoadError
1212

1313

14-
class TestFunctionsRegistry(unittest.TestCase):
14+
class TestFunctionsRegistry(testutils.AsyncTestCase):
1515

16-
def setUp(self) -> None:
16+
def setUp(self):
1717
def dummy():
1818
return "test"
1919

2020
self.dummy = dummy
2121
self.func = Function(self.dummy, "test.py")
2222
self.function_registry = functions.Registry()
2323

24-
def test_add_indexed_function_invalid_direction(self):
24+
async def test_add_indexed_function_invalid_direction(self):
25+
# Ensures that azure-functions is loaded and BINDING_REGISTRY
26+
# is not None
27+
async with testutils.start_mockhost() as host:
28+
await host.init_worker()
29+
2530
trigger1 = HttpTrigger(name="req1", route="test")
2631
binding = BlobInput(name="$return", path="testpath",
2732
connection="testconnection")

0 commit comments

Comments
 (0)