diff --git a/.github/Scripts/deferred-bindings-e2e-tests.sh b/.github/Scripts/deferred-bindings-e2e-tests.sh deleted file mode 100644 index 78c5a582..00000000 --- a/.github/Scripts/deferred-bindings-e2e-tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/extension_tests/deferred_bindings_tests \ No newline at end of file diff --git a/.github/Scripts/e2e-tests.sh b/.github/Scripts/e2e-tests.sh deleted file mode 100644 index 83cd221b..00000000 --- a/.github/Scripts/e2e-tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append --ignore=tests/endtoend/test_worker_process_count_functions.py --ignore=tests/endtoend/test_threadpool_thread_count_functions.py tests/endtoend \ No newline at end of file diff --git a/.github/Scripts/fwpc-e2e-tests.sh b/.github/Scripts/fwpc-e2e-tests.sh deleted file mode 100644 index d1196cb8..00000000 --- a/.github/Scripts/fwpc-e2e-tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -python -m pytest -q -n 1 --dist loadfile --reruns 4 --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 \ No newline at end of file diff --git a/eng/ci/integration-tests.yml b/eng/ci/integration-tests.yml index 31b5455a..b94d7fd1 100644 --- a/eng/ci/integration-tests.yml +++ b/eng/ci/integration-tests.yml @@ -29,6 +29,10 @@ variables: - template: /ci/variables/build.yml@eng - template: /ci/variables/cfs.yml@eng - group: python-integration-resources + - name: isSdkRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')] + - name: isExtensionsRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')] extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es diff --git a/eng/scripts/install-dependencies.sh b/eng/scripts/install-dependencies.sh new file mode 100644 index 00000000..d1b95364 --- /dev/null +++ b/eng/scripts/install-dependencies.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +python -m pip install --upgrade pip +python -m pip install -U azure-functions --pre +python -m pip install -U -e .[dev] + +if [[ $1 != "3.7" ]]; then + python -m pip install --pre -U -e .[test-http-v2] +fi +if [[ $1 != "3.7" && $1 != "3.8" ]]; then + python -m pip install --pre -U -e .[test-deferred-bindings] +fi \ No newline at end of file diff --git a/eng/scripts/test-setup.sh b/eng/scripts/test-setup.sh new file mode 100644 index 00000000..d062021d --- /dev/null +++ b/eng/scripts/test-setup.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd tests +python -m invoke -c test_setup build-protos +python -m invoke -c test_setup webhost --branch-name=dev +python -m invoke -c test_setup extensions \ No newline at end of file diff --git a/eng/templates/jobs/ci-unit-tests.yml b/eng/templates/jobs/ci-unit-tests.yml index cf31f94f..09908451 100644 --- a/eng/templates/jobs/ci-unit-tests.yml +++ b/eng/templates/jobs/ci-unit-tests.yml @@ -26,20 +26,13 @@ jobs: inputs: version: 8.0.x - bash: | - python -m pip install --upgrade pip - python -m pip install -U azure-functions --pre - python -m pip install -U -e .[dev] - - if [[ $(PYTHON_VERSION) != "3.7" ]]; then - python -m pip install --pre -U -e .[test-http-v2] - fi - - cd tests - python -m invoke -c test_setup build-protos - python -m invoke -c test_setup webhost --branch-name=dev - python -m invoke -c test_setup extensions + chmod +x eng/scripts/install-dependencies.sh + chmod +x eng/scripts/test-setup.sh + + eng/scripts/install-dependencies.sh $(PYTHON_VERSION) + eng/scripts/test-setup.sh displayName: 'Install dependencies' - bash: | - python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch tests/unittests + python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch tests/unittests displayName: "Running $(PYTHON_VERSION) Unit Tests" \ No newline at end of file diff --git a/eng/templates/official/jobs/ci-custom-image-tests.yml b/eng/templates/official/jobs/ci-custom-image-tests.yml index 2a280fa3..cb08f8a5 100644 --- a/eng/templates/official/jobs/ci-custom-image-tests.yml +++ b/eng/templates/official/jobs/ci-custom-image-tests.yml @@ -12,13 +12,9 @@ jobs: inputs: versionSpec: $(CUSTOM_PYTHON_VERSION) - bash: | - python -m pip install -U -e .[dev] - if [[ $(PYTHON_VERSION) != "3.7" ]]; then - python -m pip install --pre -U -e .[test-http-v2] - fi - if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install --pre -U -e .[test-deferred-bindings] - fi + chmod +x eng/scripts/install-dependencies.sh + + eng/scripts/install-dependencies.sh $(PYTHON_VERSION) cd tests python -m invoke -c test_setup build-protos displayName: 'Install dependencies' diff --git a/eng/templates/official/jobs/ci-docker-consumption-tests.yml b/eng/templates/official/jobs/ci-docker-consumption-tests.yml index 56d2e8f6..f1a4a23f 100644 --- a/eng/templates/official/jobs/ci-docker-consumption-tests.yml +++ b/eng/templates/official/jobs/ci-docker-consumption-tests.yml @@ -51,11 +51,9 @@ jobs: inputs: versionSpec: $(PYTHON_VERSION) - bash: | - python -m pip install -U -e .[dev] - python -m pip install --pre -U -e .[test-http-v2] - if [[ $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install --pre -U -e .[test-deferred-bindings] - fi + chmod +x eng/scripts/install-dependencies.sh + + eng/scripts/install-dependencies.sh $(PYTHON_VERSION) cd tests python -m invoke -c test_setup build-protos displayName: 'Install dependencies' diff --git a/eng/templates/official/jobs/ci-docker-dedicated-tests.yml b/eng/templates/official/jobs/ci-docker-dedicated-tests.yml index caea1ac5..b76b1f88 100644 --- a/eng/templates/official/jobs/ci-docker-dedicated-tests.yml +++ b/eng/templates/official/jobs/ci-docker-dedicated-tests.yml @@ -51,11 +51,9 @@ jobs: inputs: versionSpec: $(PYTHON_VERSION) - bash: | - python -m pip install -U -e .[dev] - python -m pip install --pre -U -e .[test-http-v2] - if [[ $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install --pre -U -e .[test-deferred-bindings] - fi + chmod +x eng/scripts/install-dependencies.sh + + eng/scripts/install-dependencies.sh $(PYTHON_VERSION) cd tests python -m invoke -c test_setup build-protos displayName: 'Install dependencies' diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index d1dbc04b..9d12ee2e 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -72,23 +72,13 @@ jobs: inputs: version: 8.0.x - bash: | - python -m pip install --upgrade pip - python -m pip install -U azure-functions --pre - python -m pip install -U -e .[dev] - - if [[ $(PYTHON_VERSION) != "3.7" ]]; then - python -m pip install --pre -U -e .[test-http-v2] - fi - if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install --pre -U -e .[test-deferred-bindings] - fi - - cd tests - python -m invoke -c test_setup build-protos - python -m invoke -c test_setup webhost --branch-name=dev - python -m invoke -c test_setup extensions + chmod +x eng/scripts/install-dependencies.sh + chmod +x eng/scripts/test-setup.sh + + eng/scripts/install-dependencies.sh $(PYTHON_VERSION) + eng/scripts/test-setup.sh displayName: 'Install dependencies and the worker' - condition: and(ne(variables['Build.SourceBranch'], 'refs/heads/sdk/*'), ne(variables['Build.SourceBranch'], 'refs/heads/extensions/*')) + condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false)) - task: DownloadPipelineArtifact@2 displayName: 'Download Python SDK Artifact' inputs: @@ -98,7 +88,7 @@ jobs: definition: 679 buildVersionToDownload: latest targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/sdk/*') + condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) - bash: | python -m pip install --upgrade pip python -m pip install -e $(Pipeline.Workspace)/PythonSdkArtifact @@ -111,12 +101,10 @@ jobs: python -m pip install --pre -U -e .[test-deferred-bindings] fi - cd tests - python -m invoke -c test_setup build-protos - python -m invoke -c test_setup webhost --branch-name=dev - python -m invoke -c test_setup extensions + chmod +x eng/scripts/test-setup.sh + eng/scripts/test-setup.sh displayName: 'Install test python sdk, dependencies and the worker' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/sdk/*') + condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) - task: DownloadPipelineArtifact@2 displayName: 'Download Python Extension Artifact' inputs: @@ -126,7 +114,7 @@ jobs: definition: 798 buildVersionToDownload: latest targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/extensions/*') + condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) - bash: | python -m pip install --upgrade pip @@ -141,12 +129,11 @@ jobs: python -m pip install -U -e .[dev] - cd tests - python -m invoke -c test_setup build-protos - python -m invoke -c test_setup webhost --branch-name=dev - python -m invoke -c test_setup extensions + + chmod +x eng/scripts/test-setup.sh + eng/scripts/test-setup.sh displayName: 'Install test python extension, dependencies and the worker' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/extensions/*') + condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) - bash: | python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend tests/extension_tests/deferred_bindings_tests tests/extension_tests/http_v2_tests env: @@ -157,5 +144,5 @@ jobs: AzureWebJobsSqlConnectionString: $(SQL_CONNECTION) AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI) AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION) - USETESTPYTHONSDK: eq(variables['Build.SourceBranch'], 'refs/heads/sdk/*') + USETESTPYTHONSDK: eq(variables.isSdkRelease, true) displayName: "Running $(PYTHON_VERSION) Python E2E Tests" diff --git a/python/test/worker.config.json b/python/test/worker.config.json index 3fc2a923..dbb1480b 100644 --- a/python/test/worker.config.json +++ b/python/test/worker.config.json @@ -6,4 +6,4 @@ "defaultWorkerPath":"worker.py", "workerIndexing": "true" } -} +} \ No newline at end of file