Skip to content

Commit

Permalink
Docker e2e test fixes (#1192)
Browse files Browse the repository at this point in the history
* Docker e2e test fixes

* Installing libraries in the container

* Fixing broken tests

* Skipping check log tests

* Skipping dependency isolation tests for docker tests

* Adding worker indexing flag

* Adding os.env to the docker container

* Added env variables to docker container

* None check for env

* Added retries

* Removing unused variable

* Refactored and fixed flaky tests

* Skipping durable and table tests

* Installing azure-eventhub in the docker container

* Fix eventhub function.json

* Added eventhub library

* Docker comment workflow update

* updated docker workflow to check for comment

* Update github workflow

* Testing issue_comment

* Issue comment test

* Issue comment test

* Reverted workflow changes

* Installing libraries for eventhub batch

* Added retries to workflow

* Updated eventhub testscase

* Fixing env variables

* Removing xdist

* Fixed eventhub tests

* Fixing eventhub with longer wait and retries

* Addressed comments

* Skipping durable tests

* Added custom image env

* Removing env variables

* Running setup build

* Updated comments

* Minor fixes and refactoring

* Addind setup build to consumption tests

---------

Co-authored-by: Gavin Aguiar <gavin@GavinPC>
  • Loading branch information
gavin-aguiar and Gavin Aguiar authored Apr 27, 2023
1 parent 35bb495 commit 201c547
Show file tree
Hide file tree
Showing 90 changed files with 492 additions and 207 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci_consumption_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U -e .[dev]
python setup.py build
- name: Running 3.7 Tests
if: matrix.python-version == 3.7
env:
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }}
run: python -m pytest -n auto --instafail tests/consumption_tests
run: python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests
- name: Running 3.8 Tests
if: matrix.python-version == 3.8
env:
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }}
run: python -m pytest -n auto --instafail tests/consumption_tests
run: python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests
- name: Running 3.9 Tests
if: matrix.python-version == 3.9
env:
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }}
run: python -m pytest -n auto --instafail tests/consumption_tests
run: python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests
- name: Running 3.10 Tests
if: matrix.python-version == 3.10
env:
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }}
run: python -m pytest -n auto --instafail tests/consumption_tests
run: python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests
20 changes: 7 additions & 13 deletions .github/workflows/ci_docker_con_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: CI Docker Consumption tests
on:
workflow_dispatch:
schedule:
# Monday to Thursday 1 AM PDT build
# Monday to Thursday 2 AM PDT build
# * is a special character in YAML so you have to quote this string
- cron: "0 8 * * 1,2,3,4"
- cron: "0 9 * * *"

jobs:
build:
Expand All @@ -30,6 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U -e .[dev]
python setup.py build
- name: Running 3.7 Tests
if: matrix.python-version == 3.7
env:
Expand All @@ -41,7 +42,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.8 Tests
if: matrix.python-version == 3.8
env:
Expand All @@ -53,7 +54,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.9 Tests
if: matrix.python-version == 3.9
env:
Expand All @@ -65,7 +66,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.10 Tests
if: matrix.python-version == 3.10
env:
Expand All @@ -77,11 +78,4 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
- name: Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml # optional
flags: unittests # optional
name: codecov # optional
fail_ci_if_error: false # optional (default = false)
python -m pytest --reruns 4 -vv --instafail tests/endtoend
19 changes: 6 additions & 13 deletions .github/workflows/ci_docker_ded_workflow.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# This workflow will run all tests in endtoend/tests in a docker container using the latest dedicated image


name: CI Docker Dedicated tests

on:
workflow_dispatch:
schedule:
# Monday to Thursday 1 AM PDT build
# * is a special character in YAML so you have to quote this string
- cron: "0 8 * * 1,2,3,4"
- cron: "0 8 * * *"

jobs:
build:
Expand All @@ -31,6 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U -e .[dev]
python setup.py build
- name: Running 3.7 Tests
if: matrix.python-version == 3.7
env:
Expand All @@ -42,7 +42,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.8 Tests
if: matrix.python-version == 3.8
env:
Expand All @@ -54,7 +54,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.9 Tests
if: matrix.python-version == 3.9
env:
Expand All @@ -66,7 +66,7 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
python -m pytest --reruns 4 -vv --instafail tests/endtoend
- name: Running 3.10 Tests
if: matrix.python-version == 3.10
env:
Expand All @@ -78,11 +78,4 @@ jobs:
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }}
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
run: |
python -m pytest -n auto --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
- name: Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml # optional
flags: unittests # optional
name: codecov # optional
fail_ci_if_error: false # optional (default = false)
python -m pytest --reruns 4 -vv --instafail tests/endtoend
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ignore:
- "tests/utils/testutils.py"
- "tests/utils/testutils_lc.py"
- "tests/utils/"

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import azure.functions as func

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.function_name(name="blob_trigger")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import azure.functions as func

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.function_name(name="blob_trigger")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/get_blob_as_str/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/get_blob_bytes/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/get_blob_return/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/get_blob_str/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/put_blob_bytes/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/put_blob_return/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/put_blob_str/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
3 changes: 2 additions & 1 deletion tests/endtoend/blob_functions/put_blob_trigger/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"type": "httpTrigger",
"direction": "in",
"name": "req"
"name": "req",
"authLevel": "anonymous"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import azure.functions as func
from blueprint import bp

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

app.register_functions(bp)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from blueprint import bp

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

app.register_blueprint(bp)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import azure.functions as func

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.route(route="return_http")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License.
import azure.functions as func

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.route()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License.
import azure.functions as func

app = func.FunctionApp()
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.generic_trigger(arg_name="req", type="httpTrigger")
Expand Down
Loading

0 comments on commit 201c547

Please sign in to comment.