Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: dev library testing based on branch name or variable #1538

Merged
merged 13 commits into from
Jul 30, 2024
2 changes: 0 additions & 2 deletions .github/Scripts/deferred-bindings-e2e-tests.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .github/Scripts/e2e-tests.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .github/Scripts/fwpc-e2e-tests.sh

This file was deleted.

4 changes: 4 additions & 0 deletions eng/ci/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions eng/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions eng/scripts/test-setup.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 6 additions & 13 deletions eng/templates/jobs/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

10 changes: 3 additions & 7 deletions eng/templates/official/jobs/ci-custom-image-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 3 additions & 5 deletions eng/templates/official/jobs/ci-docker-consumption-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 3 additions & 5 deletions eng/templates/official/jobs/ci-docker-dedicated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
45 changes: 16 additions & 29 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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"
2 changes: 1 addition & 1 deletion python/test/worker.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"defaultWorkerPath":"worker.py",
"workerIndexing": "true"
}
}
}
Loading