Skip to content

Commit 8fdab32

Browse files
authored
Refactor tests into E2E and unit tests (#487)
1 parent 019260a commit 8fdab32

File tree

216 files changed

+98
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+98
-79
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export AzureWebJobsStorage=$LINUXSTORAGECONNECTIONSTRING
55
export AzureWebJobsCosmosDBConnectionString=$LINUXCOSMOSDBCONNECTIONSTRING
66
export AzureWebJobsEventHubConnectionString=$LINUXEVENTHUBCONNECTIONSTRING
77
export AzureWebJobsServiceBusConnectionString=$LINUXSERVICEBUSCONNECTIONSTRING
8-
python setup.py test
8+
pytest tests/endtoend

.ci/linux_devops_unit_tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
set -e -x
4+
pytest tests/unittests

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ exclude =
44
.git, __pycache__, build, dist, .eggs, .github, .local, docs/,
55
Samples, azure/functions_worker/protos/,
66
azure/functions_worker/typing_inspect.py,
7-
tests/test_typing_inspect.py
7+
tests/unittests/test_typing_inspect.py

azure-pipelines.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ jobs:
3939
scriptPath: .ci/linux_devops_build.sh
4040
displayName: 'Build'
4141
- bash: |
42-
chmod +x .ci/linux_devops_tests.sh
43-
.ci/linux_devops_tests.sh
42+
chmod +x .ci/linux_devops_unit_tests.sh
43+
.ci/linux_devops_unit_tests.sh
44+
displayName: 'Unit Tests'
45+
- bash: |
46+
chmod +x .ci/linux_devops_e2e_tests.sh
47+
.ci/linux_devops_e2e_tests.sh
4448
env:
4549
LINUXSTORAGECONNECTIONSTRING: $(LinuxStorageConnectionString)
4650
LINUXCOSMOSDBCONNECTIONSTRING: $(LinuxCosmosDBConnectionString)
4751
LINUXEVENTHUBCONNECTIONSTRING: $(LinuxEventHubConnectionString)
4852
LINUXSERVICEBUSCONNECTIONSTRING: $(LinuxServiceBusConnectionString)
49-
displayName: 'Tests'
53+
displayName: 'E2E Tests'
5054
5155
- template: pack/templates/win_env_gen.yml
5256
parameters:

azure/functions_worker/testutils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636

3737
PROJECT_ROOT = pathlib.Path(__file__).parent.parent.parent
3838
TESTS_ROOT = PROJECT_ROOT / 'tests'
39+
E2E_TESTS_FOLDER = pathlib.Path('endtoend')
40+
E2E_TESTS_ROOT = TESTS_ROOT / E2E_TESTS_FOLDER
41+
UNIT_TESTS_FOLDER = pathlib.Path('unittests')
42+
UNIT_TESTS_ROOT = TESTS_ROOT / UNIT_TESTS_FOLDER
3943
DEFAULT_WEBHOST_DLL_PATH = PROJECT_ROOT / 'build' / 'webhost' / \
4044
'Microsoft.Azure.WebJobs.Script.WebHost.dll'
4145
EXTENSIONS_PATH = PROJECT_ROOT / 'build' / 'extensions' / 'bin'
42-
FUNCS_PATH = TESTS_ROOT / 'http_functions'
46+
FUNCS_PATH = TESTS_ROOT / UNIT_TESTS_FOLDER / 'http_functions'
4347
WORKER_PATH = PROJECT_ROOT / 'python'
4448
WORKER_CONFIG = PROJECT_ROOT / '.testconfig'
4549
ON_WINDOWS = platform.system() == 'Windows'
@@ -467,7 +471,7 @@ async def __aexit__(self, *exc):
467471
self._host = None
468472

469473

470-
def start_mockhost(*, script_root='http_functions'):
474+
def start_mockhost(*, script_root=FUNCS_PATH):
471475
tests_dir = TESTS_ROOT
472476
scripts_dir = tests_dir / script_root
473477
if not scripts_dir.exists() or not scripts_dir.is_dir():
@@ -678,7 +682,7 @@ def _setup_func_app(app_root):
678682
with open(host_json, 'w') as f:
679683
f.write(HOST_JSON_TEMPLATE)
680684

681-
_symlink_dir(TESTS_ROOT / 'ping', ping_func)
685+
_symlink_dir(TESTS_ROOT / 'common' / 'ping', ping_func)
682686
_symlink_dir(EXTENSIONS_PATH, extensions)
683687

684688

tests/broken_functions/invalid_in_anno/function.json renamed to tests/common/ping/function.json

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)