Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/templates/official/jobs/ci-custom-image-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
python -m pytest --reruns 4 -vv --instafail tests/endtoend
env:
DEDICATED_DOCKER_TEST: $(CUSTOM_DED_IMAGE)
CONSUMPTION_DOCKER_TEST: $(CUSTOM_CON_IMAGE)
IMAGE_NAME: $(CUSTOM_IMAGE_NAME)
AzureWebJobsStorage: $(LinuxStorageConnectionString311)
AzureWebJobsCosmosDBConnectionString: $(LinuxCosmosDBConnectionString311)
Expand Down
16 changes: 8 additions & 8 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ jobs:
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312)
Python313:
PYTHON_VERSION: '3.13'
STORAGE_CONNECTION: $(LinuxStorageConnectionString312)
SQL_CONNECTION: $(LinuxSqlConnectionString312)
EVENTGRID_URI: $(LinuxEventGridTopicUriString312)
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312)
STORAGE_CONNECTION: $(LinuxStorageConnectionString37)
SQL_CONNECTION: $(LinuxSqlConnectionString37)
EVENTGRID_URI: $(LinuxEventGridTopicUriString37)
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString37)
Python314:
PYTHON_VERSION: '3.14'
STORAGE_CONNECTION: $(LinuxStorageConnectionString312)
SQL_CONNECTION: $(LinuxSqlConnectionString312)
EVENTGRID_URI: $(LinuxEventGridTopicUriString312)
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312)
STORAGE_CONNECTION: $(LinuxStorageConnectionString38)
SQL_CONNECTION: $(LinuxSqlConnectionString38)
EVENTGRID_URI: $(LinuxEventGridTopicUriString38)
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString38)
steps:
- bash: |
echo "Disk space before cleanup:"
Expand Down
5 changes: 2 additions & 3 deletions workers/tests/emulator_tests/test_durable_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

import requests
from tests.utils import testutils
from tests.utils.constants import CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST
from tests.utils.constants import DEDICATED_DOCKER_TEST

from azure_functions_worker.utils.common import is_envvar_true


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Docker tests cannot retrieve port needed for a webhook")
class TestDurableFunctions(testutils.WebHostTestCase):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from requests import Response
from tests.utils import testutils
from tests.utils.constants import (
CONSUMPTION_DOCKER_TEST,
DEDICATED_DOCKER_TEST,
PYAZURE_INTEGRATION_TEST,
)
Expand All @@ -19,8 +18,7 @@
REQUEST_TIMEOUT_SEC = 5


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
'Docker tests do not work with dependency isolation ')
class TestGRPCandProtobufDependencyIsolationOnDedicated(
testutils.WebHostTestCase):
Expand Down
6 changes: 2 additions & 4 deletions workers/tests/endtoend/test_eventgrid_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import requests
from tests.utils import testutils
from tests.utils.constants import DEDICATED_DOCKER_TEST, CONSUMPTION_DOCKER_TEST
from tests.utils.constants import DEDICATED_DOCKER_TEST
from azure_functions_worker.utils.common import is_envvar_true


@unittest.skip("Temporary skip")
class TestEventGridFunctions(testutils.WebHostTestCase):

@classmethod
Expand Down Expand Up @@ -93,8 +92,7 @@ def test_eventgrid_trigger(self):
else:
break

@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
'EventGrid connection string not available in docker tests')
def test_eventgrid_output_binding(self):
"""test event_grid output binding
Expand Down
8 changes: 3 additions & 5 deletions workers/tests/endtoend/test_http_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import requests
from tests.utils import testutils
from tests.utils.constants import CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST
from tests.utils.constants import DEDICATED_DOCKER_TEST

# This app setting is only present for Python < 3.13
from azure_functions_worker.constants import PYTHON_ENABLE_INIT_INDEXING
Expand All @@ -21,8 +21,7 @@
REQUEST_TIMEOUT_SEC = 5


@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
@unittest.skipIf(sys.version_info.minor < 8, "HTTPv2"
"is only supported for 3.8+.")
Expand Down Expand Up @@ -197,8 +196,7 @@ def send_request():
self.assertEqual(content, complete_data)


@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@unittest.skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
@unittest.skipIf(sys.version_info.minor >= 13,
"App Setting is not needed for 3.13+")
Expand Down
8 changes: 3 additions & 5 deletions workers/tests/endtoend/test_warmup_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
from unittest import skipIf

from tests.utils import testutils
from tests.utils.constants import CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST
from tests.utils.constants import DEDICATED_DOCKER_TEST

from azure_functions_worker.utils.common import is_envvar_true


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Docker tests cannot call admin functions")
class TestWarmupFunctions(testutils.WebHostTestCase):
"""Test the Warmup Trigger in the local webhost.
Expand All @@ -36,8 +35,7 @@ def check_log_warmup(self, host_out: typing.List[str]):
self.assertEqual(host_out.count("Function App instance is warm"), 1)


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Docker tests cannot call admin functions")
class TestWarmupFunctionsStein(TestWarmupFunctions):

Expand Down
14 changes: 5 additions & 9 deletions workers/tests/endtoend/test_worker_process_count_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

from tests.utils import testutils
from azure_functions_worker.utils.common import is_envvar_true
from tests.utils.constants import CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST
from tests.utils.constants import DEDICATED_DOCKER_TEST


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
class TestWorkerProcessCount(testutils.WebHostTestCase):
"""Test the Http Trigger with setting up the python worker process count
Expand Down Expand Up @@ -70,8 +69,7 @@ def http_req(res_num):
self.assertTrue(time_diff_in_seconds < 1)


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
class TestWorkerProcessCountStein(TestWorkerProcessCount):
@classmethod
Expand All @@ -80,8 +78,7 @@ def get_script_dir(cls):
'http_functions_stein'


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
class TestWorkerProcessCountWithBlueprintStein(TestWorkerProcessCount):
@classmethod
Expand All @@ -90,8 +87,7 @@ def get_script_dir(cls):
'functions_in_blueprint_only'


@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST)
or is_envvar_true(CONSUMPTION_DOCKER_TEST),
@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST),
"Tests are flaky when running on Docker")
class TestWorkerProcessCountWithBlueprintDiffDirStein(TestWorkerProcessCount):
@classmethod
Expand Down
26 changes: 15 additions & 11 deletions workers/tests/unittests/test_shared_memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ def test_large_invalid_bytes_input_support(self):
be transfered over shared memory.
The input is bytes of larger than the allowed size.
"""
class _LargeBytes(bytes):
"""Stub that reports a 2GB+ length without allocating real memory."""
def __len__(self):
return consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER + 10

manager = SharedMemoryManager()
content_size = consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER + 10
# Not using get_random_bytes to avoid slowing down for creating a large
# random input
content = b'x01' * content_size
bytes_datum = bind_meta.Datum(type='bytes', value=content)
bytes_datum = bind_meta.Datum(type='bytes', value=_LargeBytes())
is_supported = manager.is_supported(bytes_datum)
self.assertFalse(is_supported)

Expand All @@ -219,13 +220,16 @@ def test_large_invalid_string_input_support(self):
be transfered over shared memory.
The input is string of larger than the allowed size.
"""
class _LargeString(str):
"""Stub that reports a 2GB+ length without allocating real memory."""
def __len__(self):
return math.floor(
(consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER + 10)
/ consts.SIZE_OF_CHAR_BYTES
)

manager = SharedMemoryManager()
content_size = consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER + 10
num_chars = math.floor(content_size / consts.SIZE_OF_CHAR_BYTES)
# Not using get_random_string to avoid slowing down for creating a large
# random input
content = 'a' * num_chars
string_datum = bind_meta.Datum(type='string', value=content)
string_datum = bind_meta.Datum(type='string', value=_LargeString())
is_supported = manager.is_supported(string_datum)
self.assertFalse(is_supported)

Expand Down
1 change: 0 additions & 1 deletion workers/tests/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
ARCHIVE_WEBHOST_LOGS = "ARCHIVE_WEBHOST_LOGS"

# CI test constants
CONSUMPTION_DOCKER_TEST = "CONSUMPTION_DOCKER_TEST"
DEDICATED_DOCKER_TEST = "DEDICATED_DOCKER_TEST"

# Master key used in the webhost Secrets/host.json template; required to call
Expand Down
19 changes: 5 additions & 14 deletions workers/tests/utils/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import requests
from tests.utils.constants import (
ARCHIVE_WEBHOST_LOGS,
CONSUMPTION_DOCKER_TEST,
DEDICATED_DOCKER_TEST,
EXTENSIONS_CSPROJ_TEMPLATE,
MASTER_KEY,
Expand All @@ -47,7 +46,6 @@
)
from tests.utils.testutils_docker import (
DockerConfigs,
WebHostConsumption,
WebHostDedicated,
)

Expand Down Expand Up @@ -145,8 +143,7 @@ class AsyncTestCase(unittest.TestCase, metaclass=AsyncTestCaseMeta):
class WebHostTestCaseMeta(type(unittest.TestCase)):

def __new__(mcls, name, bases, dct):
if is_envvar_true(DEDICATED_DOCKER_TEST) \
or is_envvar_true(CONSUMPTION_DOCKER_TEST):
if is_envvar_true(DEDICATED_DOCKER_TEST):
return super().__new__(mcls, name, bases, dct)

for attrname, attr in dct.items():
Expand Down Expand Up @@ -216,13 +213,10 @@ def get_environment_variables(cls):
@classmethod
def docker_tests_enabled(self) -> (bool, str):
"""
Returns True if the environment variables
CONSUMPTION_DOCKER_TEST or DEDICATED_DOCKER_TEST
is enabled else returns False
Returns True if the environment variable
DEDICATED_DOCKER_TEST is enabled else returns False
"""
if is_envvar_true(CONSUMPTION_DOCKER_TEST):
return True, CONSUMPTION_DOCKER_TEST
elif is_envvar_true(DEDICATED_DOCKER_TEST):
if is_envvar_true(DEDICATED_DOCKER_TEST):
return True, DEDICATED_DOCKER_TEST
else:
return False, None
Expand All @@ -243,10 +237,7 @@ def setUpClass(cls):
script_path=script_dir,
libraries=cls.get_libraries_to_install(),
env=cls.get_environment_variables() or {})
if sku == CONSUMPTION_DOCKER_TEST:
cls.webhost = \
WebHostConsumption(docker_configs).spawn_container()
elif sku == DEDICATED_DOCKER_TEST:
if sku == DEDICATED_DOCKER_TEST:
cls.webhost = \
WebHostDedicated(docker_configs).spawn_container()
else:
Expand Down
11 changes: 0 additions & 11 deletions workers/tests/utils/testutils_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,6 @@ def create_container(self, image_repo: str, image_url: str,
return WebHostProxy(run_process, self._addr)


class WebHostConsumption(WebHostDockerContainerBase):

def __init__(self, configs: DockerConfigs):
self.configs = configs

def spawn_container(self):
return self.create_container(_MESH_IMAGE_REPO,
_MESH_IMAGE_URL,
self.configs)


class WebHostDedicated(WebHostDockerContainerBase):

def __init__(self, configs: DockerConfigs):
Expand Down
Loading