From 87d5f38b501b6ae2c3379346606685d91d66e057 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 1 Mar 2023 16:08:32 -0600 Subject: [PATCH 01/38] Docker e2e test fixes --- .github/workflows/ci_docker_ded_workflow.yml | 4 ++ .../blob_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../get_blob_as_bytes/function.json | 3 +- .../function.json | 3 +- .../function.json | 3 +- .../get_blob_as_str/function.json | 3 +- .../function.json | 3 +- .../get_blob_bytes/function.json | 3 +- .../get_blob_filelike/function.json | 3 +- .../get_blob_return/function.json | 3 +- .../blob_functions/get_blob_str/function.json | 3 +- .../get_blob_triggered/function.json | 3 +- .../function.json | 3 +- .../function.json | 3 +- .../put_blob_bytes/function.json | 3 +- .../put_blob_filelike/function.json | 3 +- .../put_blob_return/function.json | 3 +- .../blob_functions/put_blob_str/function.json | 3 +- .../put_blob_trigger/function.json | 3 +- .../function.json | 3 +- .../function_app.py | 2 +- .../function_app.py | 2 +- .../function_app.py | 2 +- .../cosmosdb_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../cosmosdb_input/function.json | 3 +- .../get_cosmosdb_triggered/function.json | 3 +- .../put_document/function.json | 3 +- .../eventgrid_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../eventgrid_output_binding/function.json | 3 +- .../function.json | 3 +- .../get_eventgrid_triggered/function.json | 3 +- .../function_app.py | 2 +- .../eventhub_output_batch/function.json | 3 +- .../function.json | 4 +- .../function.json | 3 +- .../metadata_output_batch/function.json | 3 +- .../eventhub_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../eventhub_output/function.json | 3 +- .../get_eventhub_triggered/function.json | 3 +- .../get_metadata_triggered/function.json | 3 +- .../metadata_output/function.json | 3 +- .../function_app.py | 2 +- .../dotenv_func/function.json | 2 +- .../numpy_func/function.json | 2 +- .../opencv_func/function.json | 2 +- .../pandas_func/function.json | 2 +- .../plotly_func/function.json | 2 +- .../requests_func/function.json | 2 +- .../sklearn_func/function.json | 2 +- .../http_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../get_queue_blob/function.json | 3 +- .../function.json | 3 +- .../get_queue_blob_return/function.json | 3 +- .../function.json | 3 +- .../queue_functions/put_queue/function.json | 3 +- .../put_queue_message_return/function.json | 3 +- .../put_queue_multiple_out/function.json | 3 +- .../put_queue_return/function.json | 3 +- .../put_queue_return_multiple/function.json | 3 +- .../put_queue_untyped_return/function.json | 3 +- .../queue_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- .../get_servicebus_triggered/function.json | 3 +- .../put_message/function.json | 3 +- .../function_app.py | 2 +- .../generic/function_app.py | 2 +- .../table_functions_stein/function_app.py | 2 +- .../generic/function_app.py | 2 +- tests/endtoend/test_blob_functions.py | 1 + .../timer_functions_stein/function_app.py | 2 +- tests/utils/testutils_docker.py | 41 ++++++++----------- 76 files changed, 140 insertions(+), 97 deletions(-) diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 9de65a875..d5ed8242f 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -5,6 +5,10 @@ name: CI Docker Dedicated tests on: workflow_dispatch: + push: + branches: [ dev, master, main, release/* ] + pull_request: + branches: [ dev, master, main, release/* ] schedule: # Monday to Thursday 1 AM PDT build # * is a special character in YAML so you have to quote this string diff --git a/tests/endtoend/blob_functions/blob_functions_stein/function_app.py b/tests/endtoend/blob_functions/blob_functions_stein/function_app.py index 0415c50ca..2621a3360 100644 --- a/tests/endtoend/blob_functions/blob_functions_stein/function_app.py +++ b/tests/endtoend/blob_functions/blob_functions_stein/function_app.py @@ -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") diff --git a/tests/endtoend/blob_functions/blob_functions_stein/generic/function_app.py b/tests/endtoend/blob_functions/blob_functions_stein/generic/function_app.py index db2bafbd7..d902a09ef 100644 --- a/tests/endtoend/blob_functions/blob_functions_stein/generic/function_app.py +++ b/tests/endtoend/blob_functions/blob_functions_stein/generic/function_app.py @@ -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") diff --git a/tests/endtoend/blob_functions/get_blob_as_bytes/function.json b/tests/endtoend/blob_functions/get_blob_as_bytes/function.json index daaf6cb35..79caf12a9 100644 --- a/tests/endtoend/blob_functions/get_blob_as_bytes/function.json +++ b/tests/endtoend/blob_functions/get_blob_as_bytes/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_as_bytes_return_http_response/function.json b/tests/endtoend/blob_functions/get_blob_as_bytes_return_http_response/function.json index 17d0d2bf1..59e8d01cf 100644 --- a/tests/endtoend/blob_functions/get_blob_as_bytes_return_http_response/function.json +++ b/tests/endtoend/blob_functions/get_blob_as_bytes_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_as_bytes_stream_return_http_response/function.json b/tests/endtoend/blob_functions/get_blob_as_bytes_stream_return_http_response/function.json index 17d0d2bf1..59e8d01cf 100644 --- a/tests/endtoend/blob_functions/get_blob_as_bytes_stream_return_http_response/function.json +++ b/tests/endtoend/blob_functions/get_blob_as_bytes_stream_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_as_str/function.json b/tests/endtoend/blob_functions/get_blob_as_str/function.json index 2fbc5f33a..ef991b625 100644 --- a/tests/endtoend/blob_functions/get_blob_as_str/function.json +++ b/tests/endtoend/blob_functions/get_blob_as_str/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_as_str_return_http_response/function.json b/tests/endtoend/blob_functions/get_blob_as_str_return_http_response/function.json index 3de014ad3..5da04fd22 100644 --- a/tests/endtoend/blob_functions/get_blob_as_str_return_http_response/function.json +++ b/tests/endtoend/blob_functions/get_blob_as_str_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_bytes/function.json b/tests/endtoend/blob_functions/get_blob_bytes/function.json index 380782d2b..36e6472a2 100644 --- a/tests/endtoend/blob_functions/get_blob_bytes/function.json +++ b/tests/endtoend/blob_functions/get_blob_bytes/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_filelike/function.json b/tests/endtoend/blob_functions/get_blob_filelike/function.json index 7365a290d..bea089b58 100644 --- a/tests/endtoend/blob_functions/get_blob_filelike/function.json +++ b/tests/endtoend/blob_functions/get_blob_filelike/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_return/function.json b/tests/endtoend/blob_functions/get_blob_return/function.json index c4bffff01..208e1dd53 100644 --- a/tests/endtoend/blob_functions/get_blob_return/function.json +++ b/tests/endtoend/blob_functions/get_blob_return/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_str/function.json b/tests/endtoend/blob_functions/get_blob_str/function.json index d4a43c7c0..7117f87d7 100644 --- a/tests/endtoend/blob_functions/get_blob_str/function.json +++ b/tests/endtoend/blob_functions/get_blob_str/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/get_blob_triggered/function.json b/tests/endtoend/blob_functions/get_blob_triggered/function.json index 2513fd38a..9ba913e86 100644 --- a/tests/endtoend/blob_functions/get_blob_triggered/function.json +++ b/tests/endtoend/blob_functions/get_blob_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_as_bytes_return_http_response/function.json b/tests/endtoend/blob_functions/put_blob_as_bytes_return_http_response/function.json index be2691bd8..4f8821813 100644 --- a/tests/endtoend/blob_functions/put_blob_as_bytes_return_http_response/function.json +++ b/tests/endtoend/blob_functions/put_blob_as_bytes_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_as_str_return_http_response/function.json b/tests/endtoend/blob_functions/put_blob_as_str_return_http_response/function.json index 06d875094..59a6ff68a 100644 --- a/tests/endtoend/blob_functions/put_blob_as_str_return_http_response/function.json +++ b/tests/endtoend/blob_functions/put_blob_as_str_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_bytes/function.json b/tests/endtoend/blob_functions/put_blob_bytes/function.json index 63a706c79..21b47df00 100644 --- a/tests/endtoend/blob_functions/put_blob_bytes/function.json +++ b/tests/endtoend/blob_functions/put_blob_bytes/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_filelike/function.json b/tests/endtoend/blob_functions/put_blob_filelike/function.json index 49ff4f6a2..09a1bb480 100644 --- a/tests/endtoend/blob_functions/put_blob_filelike/function.json +++ b/tests/endtoend/blob_functions/put_blob_filelike/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_return/function.json b/tests/endtoend/blob_functions/put_blob_return/function.json index 34b7d08e3..662d67396 100644 --- a/tests/endtoend/blob_functions/put_blob_return/function.json +++ b/tests/endtoend/blob_functions/put_blob_return/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_str/function.json b/tests/endtoend/blob_functions/put_blob_str/function.json index b21e51c00..8b2543f90 100644 --- a/tests/endtoend/blob_functions/put_blob_str/function.json +++ b/tests/endtoend/blob_functions/put_blob_str/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_blob_trigger/function.json b/tests/endtoend/blob_functions/put_blob_trigger/function.json index 183cdaa69..b6bb70d32 100644 --- a/tests/endtoend/blob_functions/put_blob_trigger/function.json +++ b/tests/endtoend/blob_functions/put_blob_trigger/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blob_functions/put_get_multiple_blobs_as_bytes_return_http_response/function.json b/tests/endtoend/blob_functions/put_get_multiple_blobs_as_bytes_return_http_response/function.json index 5449a6921..8ec3b7737 100644 --- a/tests/endtoend/blob_functions/put_get_multiple_blobs_as_bytes_return_http_response/function.json +++ b/tests/endtoend/blob_functions/put_get_multiple_blobs_as_bytes_return_http_response/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/blueprint_functions/functions_in_blueprint_only/function_app.py b/tests/endtoend/blueprint_functions/functions_in_blueprint_only/function_app.py index fb0452655..44712bfee 100644 --- a/tests/endtoend/blueprint_functions/functions_in_blueprint_only/function_app.py +++ b/tests/endtoend/blueprint_functions/functions_in_blueprint_only/function_app.py @@ -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) diff --git a/tests/endtoend/blueprint_functions/functions_in_both_blueprint_functionapp/function_app.py b/tests/endtoend/blueprint_functions/functions_in_both_blueprint_functionapp/function_app.py index 4347b0c73..036467850 100644 --- a/tests/endtoend/blueprint_functions/functions_in_both_blueprint_functionapp/function_app.py +++ b/tests/endtoend/blueprint_functions/functions_in_both_blueprint_functionapp/function_app.py @@ -2,7 +2,7 @@ from blueprint import bp -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) app.register_blueprint(bp) diff --git a/tests/endtoend/blueprint_functions/multiple_function_registers/function_app.py b/tests/endtoend/blueprint_functions/multiple_function_registers/function_app.py index 4277df8db..2b212266d 100644 --- a/tests/endtoend/blueprint_functions/multiple_function_registers/function_app.py +++ b/tests/endtoend/blueprint_functions/multiple_function_registers/function_app.py @@ -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") diff --git a/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/function_app.py b/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/function_app.py index 6448fbbd5..715e226a9 100644 --- a/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/function_app.py +++ b/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/function_app.py @@ -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() diff --git a/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/generic/function_app.py b/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/generic/function_app.py index dee78952a..66b50ba91 100644 --- a/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/generic/function_app.py +++ b/tests/endtoend/cosmosdb_functions/cosmosdb_functions_stein/generic/function_app.py @@ -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") diff --git a/tests/endtoend/cosmosdb_functions/cosmosdb_input/function.json b/tests/endtoend/cosmosdb_functions/cosmosdb_input/function.json index a8c854586..54b7de280 100644 --- a/tests/endtoend/cosmosdb_functions/cosmosdb_input/function.json +++ b/tests/endtoend/cosmosdb_functions/cosmosdb_input/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "in", diff --git a/tests/endtoend/cosmosdb_functions/get_cosmosdb_triggered/function.json b/tests/endtoend/cosmosdb_functions/get_cosmosdb_triggered/function.json index 37c831f0b..e3778812e 100644 --- a/tests/endtoend/cosmosdb_functions/get_cosmosdb_triggered/function.json +++ b/tests/endtoend/cosmosdb_functions/get_cosmosdb_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/cosmosdb_functions/put_document/function.json b/tests/endtoend/cosmosdb_functions/put_document/function.json index 055bc68b0..c232c3659 100644 --- a/tests/endtoend/cosmosdb_functions/put_document/function.json +++ b/tests/endtoend/cosmosdb_functions/put_document/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/function_app.py b/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/function_app.py index a5a253834..d1fd116dc 100644 --- a/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/function_app.py +++ b/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/function_app.py @@ -4,7 +4,7 @@ from azure_functions_worker import logging -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="eventGridTrigger") diff --git a/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/generic/function_app.py b/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/generic/function_app.py index f2cb38ea9..c02d4f71c 100644 --- a/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/generic/function_app.py +++ b/tests/endtoend/eventgrid_functions/eventgrid_functions_stein/generic/function_app.py @@ -4,7 +4,7 @@ from azure_functions_worker import logging -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="eventGridTrigger") diff --git a/tests/endtoend/eventgrid_functions/eventgrid_output_binding/function.json b/tests/endtoend/eventgrid_functions/eventgrid_output_binding/function.json index 1c21058ab..1c0343465 100644 --- a/tests/endtoend/eventgrid_functions/eventgrid_output_binding/function.json +++ b/tests/endtoend/eventgrid_functions/eventgrid_output_binding/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "eventGrid", diff --git a/tests/endtoend/eventgrid_functions/eventgrid_output_binding_success/function.json b/tests/endtoend/eventgrid_functions/eventgrid_output_binding_success/function.json index 942da8386..e63945d3a 100644 --- a/tests/endtoend/eventgrid_functions/eventgrid_output_binding_success/function.json +++ b/tests/endtoend/eventgrid_functions/eventgrid_output_binding_success/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/eventgrid_functions/get_eventgrid_triggered/function.json b/tests/endtoend/eventgrid_functions/get_eventgrid_triggered/function.json index 956e4f830..2c2727754 100644 --- a/tests/endtoend/eventgrid_functions/get_eventgrid_triggered/function.json +++ b/tests/endtoend/eventgrid_functions/get_eventgrid_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/eventhub_batch_functions/eventhub_batch_functions_stein/function_app.py b/tests/endtoend/eventhub_batch_functions/eventhub_batch_functions_stein/function_app.py index 3163f126a..bccc29d27 100644 --- a/tests/endtoend/eventhub_batch_functions/eventhub_batch_functions_stein/function_app.py +++ b/tests/endtoend/eventhub_batch_functions/eventhub_batch_functions_stein/function_app.py @@ -6,7 +6,7 @@ import azure.functions as func from azure.eventhub import EventHubProducerClient, EventData -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) # This is an actual EventHub trigger which handles Eventhub events in batches. diff --git a/tests/endtoend/eventhub_batch_functions/eventhub_output_batch/function.json b/tests/endtoend/eventhub_batch_functions/eventhub_output_batch/function.json index f885b2168..60de05e61 100644 --- a/tests/endtoend/eventhub_batch_functions/eventhub_output_batch/function.json +++ b/tests/endtoend/eventhub_batch_functions/eventhub_output_batch/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "eventHub", diff --git a/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json b/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json index 3f68bfc1b..e1ece825c 100644 --- a/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json +++ b/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json @@ -8,8 +8,8 @@ "methods": [ "get" ], - "name": "req" - }, + "name": "req", + }", { "direction": "in", "type": "table", diff --git a/tests/endtoend/eventhub_batch_functions/get_metadata_batch_triggered/function.json b/tests/endtoend/eventhub_batch_functions/get_metadata_batch_triggered/function.json index 176be9661..4de82ecd9 100644 --- a/tests/endtoend/eventhub_batch_functions/get_metadata_batch_triggered/function.json +++ b/tests/endtoend/eventhub_batch_functions/get_metadata_batch_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/eventhub_batch_functions/metadata_output_batch/function.json b/tests/endtoend/eventhub_batch_functions/metadata_output_batch/function.json index a4846156f..89747eb27 100644 --- a/tests/endtoend/eventhub_batch_functions/metadata_output_batch/function.json +++ b/tests/endtoend/eventhub_batch_functions/metadata_output_batch/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/eventhub_functions/eventhub_functions_stein/function_app.py b/tests/endtoend/eventhub_functions/eventhub_functions_stein/function_app.py index 7973d9b5c..022a2009a 100644 --- a/tests/endtoend/eventhub_functions/eventhub_functions_stein/function_app.py +++ b/tests/endtoend/eventhub_functions/eventhub_functions_stein/function_app.py @@ -7,7 +7,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) # An HttpTrigger to generating EventHub event from EventHub Output Binding diff --git a/tests/endtoend/eventhub_functions/eventhub_functions_stein/generic/function_app.py b/tests/endtoend/eventhub_functions/eventhub_functions_stein/generic/function_app.py index e6ead2cc1..7b9f69891 100644 --- a/tests/endtoend/eventhub_functions/eventhub_functions_stein/generic/function_app.py +++ b/tests/endtoend/eventhub_functions/eventhub_functions_stein/generic/function_app.py @@ -7,7 +7,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) # An HttpTrigger to generating EventHub event from EventHub Output Binding diff --git a/tests/endtoend/eventhub_functions/eventhub_output/function.json b/tests/endtoend/eventhub_functions/eventhub_output/function.json index 65c776d28..ec96c1617 100644 --- a/tests/endtoend/eventhub_functions/eventhub_output/function.json +++ b/tests/endtoend/eventhub_functions/eventhub_output/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "eventHub", diff --git a/tests/endtoend/eventhub_functions/get_eventhub_triggered/function.json b/tests/endtoend/eventhub_functions/get_eventhub_triggered/function.json index eb1cc0efc..4328b71a5 100644 --- a/tests/endtoend/eventhub_functions/get_eventhub_triggered/function.json +++ b/tests/endtoend/eventhub_functions/get_eventhub_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/eventhub_functions/get_metadata_triggered/function.json b/tests/endtoend/eventhub_functions/get_metadata_triggered/function.json index 54974e84a..4244ca821 100644 --- a/tests/endtoend/eventhub_functions/get_metadata_triggered/function.json +++ b/tests/endtoend/eventhub_functions/get_metadata_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/eventhub_functions/metadata_output/function.json b/tests/endtoend/eventhub_functions/metadata_output/function.json index 01ff83618..9b4018660 100644 --- a/tests/endtoend/eventhub_functions/metadata_output/function.json +++ b/tests/endtoend/eventhub_functions/metadata_output/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/http_functions/common_libs_functions/common_libs_functions_stein/function_app.py b/tests/endtoend/http_functions/common_libs_functions/common_libs_functions_stein/function_app.py index fcc4b2ca7..77b929ae9 100644 --- a/tests/endtoend/http_functions/common_libs_functions/common_libs_functions_stein/function_app.py +++ b/tests/endtoend/http_functions/common_libs_functions/common_libs_functions_stein/function_app.py @@ -12,7 +12,7 @@ import dotenv -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.route(route="dotenv_func") diff --git a/tests/endtoend/http_functions/common_libs_functions/dotenv_func/function.json b/tests/endtoend/http_functions/common_libs_functions/dotenv_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/dotenv_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/dotenv_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/numpy_func/function.json b/tests/endtoend/http_functions/common_libs_functions/numpy_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/numpy_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/numpy_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/opencv_func/function.json b/tests/endtoend/http_functions/common_libs_functions/opencv_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/opencv_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/opencv_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/pandas_func/function.json b/tests/endtoend/http_functions/common_libs_functions/pandas_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/pandas_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/pandas_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/plotly_func/function.json b/tests/endtoend/http_functions/common_libs_functions/plotly_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/plotly_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/plotly_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/requests_func/function.json b/tests/endtoend/http_functions/common_libs_functions/requests_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/requests_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/requests_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/common_libs_functions/sklearn_func/function.json b/tests/endtoend/http_functions/common_libs_functions/sklearn_func/function.json index b8dc650e9..8c4cbe307 100644 --- a/tests/endtoend/http_functions/common_libs_functions/sklearn_func/function.json +++ b/tests/endtoend/http_functions/common_libs_functions/sklearn_func/function.json @@ -2,7 +2,7 @@ "scriptFile": "__init__.py", "bindings": [ { - "authLevel": "function", + "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", diff --git a/tests/endtoend/http_functions/http_functions_stein/function_app.py b/tests/endtoend/http_functions/http_functions_stein/function_app.py index 01fd52a09..9662a92a1 100644 --- a/tests/endtoend/http_functions/http_functions_stein/function_app.py +++ b/tests/endtoend/http_functions/http_functions_stein/function_app.py @@ -7,7 +7,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.route(route="default_template") diff --git a/tests/endtoend/http_functions/http_functions_stein/generic/function_app.py b/tests/endtoend/http_functions/http_functions_stein/generic/function_app.py index c5d690ffc..17e715a89 100644 --- a/tests/endtoend/http_functions/http_functions_stein/generic/function_app.py +++ b/tests/endtoend/http_functions/http_functions_stein/generic/function_app.py @@ -5,7 +5,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="default_template") diff --git a/tests/endtoend/queue_functions/get_queue_blob/function.json b/tests/endtoend/queue_functions/get_queue_blob/function.json index 2902ee1e4..4abc22167 100644 --- a/tests/endtoend/queue_functions/get_queue_blob/function.json +++ b/tests/endtoend/queue_functions/get_queue_blob/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/queue_functions/get_queue_blob_message_return/function.json b/tests/endtoend/queue_functions/get_queue_blob_message_return/function.json index bb2d84df9..7f040a6be 100644 --- a/tests/endtoend/queue_functions/get_queue_blob_message_return/function.json +++ b/tests/endtoend/queue_functions/get_queue_blob_message_return/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/queue_functions/get_queue_blob_return/function.json b/tests/endtoend/queue_functions/get_queue_blob_return/function.json index 351722f34..ce3b8c8c2 100644 --- a/tests/endtoend/queue_functions/get_queue_blob_return/function.json +++ b/tests/endtoend/queue_functions/get_queue_blob_return/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/queue_functions/get_queue_untyped_blob_return/function.json b/tests/endtoend/queue_functions/get_queue_untyped_blob_return/function.json index ff15352c2..f0f0b8c6c 100644 --- a/tests/endtoend/queue_functions/get_queue_untyped_blob_return/function.json +++ b/tests/endtoend/queue_functions/get_queue_untyped_blob_return/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/queue_functions/put_queue/function.json b/tests/endtoend/queue_functions/put_queue/function.json index 557ead29b..b8e03f2be 100644 --- a/tests/endtoend/queue_functions/put_queue/function.json +++ b/tests/endtoend/queue_functions/put_queue/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/queue_functions/put_queue_message_return/function.json b/tests/endtoend/queue_functions/put_queue_message_return/function.json index db4a7dba3..ce1de0819 100644 --- a/tests/endtoend/queue_functions/put_queue_message_return/function.json +++ b/tests/endtoend/queue_functions/put_queue_message_return/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/queue_functions/put_queue_multiple_out/function.json b/tests/endtoend/queue_functions/put_queue_multiple_out/function.json index 3b076f149..7fb98a3c2 100644 --- a/tests/endtoend/queue_functions/put_queue_multiple_out/function.json +++ b/tests/endtoend/queue_functions/put_queue_multiple_out/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "name": "resp", diff --git a/tests/endtoend/queue_functions/put_queue_return/function.json b/tests/endtoend/queue_functions/put_queue_return/function.json index 5d5e0909c..129b7cb20 100644 --- a/tests/endtoend/queue_functions/put_queue_return/function.json +++ b/tests/endtoend/queue_functions/put_queue_return/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/queue_functions/put_queue_return_multiple/function.json b/tests/endtoend/queue_functions/put_queue_return_multiple/function.json index ef0f75a05..cc1f2fc14 100644 --- a/tests/endtoend/queue_functions/put_queue_return_multiple/function.json +++ b/tests/endtoend/queue_functions/put_queue_return_multiple/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/queue_functions/put_queue_untyped_return/function.json b/tests/endtoend/queue_functions/put_queue_untyped_return/function.json index ab4c3b08e..8dee2e9c5 100644 --- a/tests/endtoend/queue_functions/put_queue_untyped_return/function.json +++ b/tests/endtoend/queue_functions/put_queue_untyped_return/function.json @@ -6,7 +6,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/queue_functions/queue_functions_stein/function_app.py b/tests/endtoend/queue_functions/queue_functions_stein/function_app.py index 9038be3e5..0b883fb12 100644 --- a/tests/endtoend/queue_functions/queue_functions_stein/function_app.py +++ b/tests/endtoend/queue_functions/queue_functions_stein/function_app.py @@ -4,7 +4,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="get_queue_blob") diff --git a/tests/endtoend/queue_functions/queue_functions_stein/generic/function_app.py b/tests/endtoend/queue_functions/queue_functions_stein/generic/function_app.py index 49d04fbfd..a2ad14b58 100644 --- a/tests/endtoend/queue_functions/queue_functions_stein/generic/function_app.py +++ b/tests/endtoend/queue_functions/queue_functions_stein/generic/function_app.py @@ -4,7 +4,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="get_queue_blob") diff --git a/tests/endtoend/servicebus_functions/get_servicebus_triggered/function.json b/tests/endtoend/servicebus_functions/get_servicebus_triggered/function.json index 71f80e9a5..944dd45a9 100644 --- a/tests/endtoend/servicebus_functions/get_servicebus_triggered/function.json +++ b/tests/endtoend/servicebus_functions/get_servicebus_triggered/function.json @@ -4,7 +4,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "type": "blob", diff --git a/tests/endtoend/servicebus_functions/put_message/function.json b/tests/endtoend/servicebus_functions/put_message/function.json index f0abd2681..722f19541 100644 --- a/tests/endtoend/servicebus_functions/put_message/function.json +++ b/tests/endtoend/servicebus_functions/put_message/function.json @@ -5,7 +5,8 @@ { "type": "httpTrigger", "direction": "in", - "name": "req" + "name": "req", + "authLevel": "anonymous" }, { "direction": "out", diff --git a/tests/endtoend/servicebus_functions/servicebus_functions_stein/function_app.py b/tests/endtoend/servicebus_functions/servicebus_functions_stein/function_app.py index 2f5d095a0..e2114fd12 100644 --- a/tests/endtoend/servicebus_functions/servicebus_functions_stein/function_app.py +++ b/tests/endtoend/servicebus_functions/servicebus_functions_stein/function_app.py @@ -2,7 +2,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.route(route="put_message") diff --git a/tests/endtoend/servicebus_functions/servicebus_functions_stein/generic/function_app.py b/tests/endtoend/servicebus_functions/servicebus_functions_stein/generic/function_app.py index 1be5c2a08..431411657 100644 --- a/tests/endtoend/servicebus_functions/servicebus_functions_stein/generic/function_app.py +++ b/tests/endtoend/servicebus_functions/servicebus_functions_stein/generic/function_app.py @@ -2,7 +2,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="put_message") diff --git a/tests/endtoend/table_functions/table_functions_stein/function_app.py b/tests/endtoend/table_functions/table_functions_stein/function_app.py index 6efb654dd..92492e87f 100644 --- a/tests/endtoend/table_functions/table_functions_stein/function_app.py +++ b/tests/endtoend/table_functions/table_functions_stein/function_app.py @@ -4,7 +4,7 @@ import uuid import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="table_in_binding") diff --git a/tests/endtoend/table_functions/table_functions_stein/generic/function_app.py b/tests/endtoend/table_functions/table_functions_stein/generic/function_app.py index a3e39711e..d52388b1b 100644 --- a/tests/endtoend/table_functions/table_functions_stein/generic/function_app.py +++ b/tests/endtoend/table_functions/table_functions_stein/generic/function_app.py @@ -4,7 +4,7 @@ import uuid import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="table_in_binding") diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index bbc096c82..2d22a88ab 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -11,6 +11,7 @@ class TestBlobFunctions(testutils.WebHostTestCase): def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'blob_functions' + @testutils.retryable_test(3, 5) def test_blob_io_str(self): r = self.webhost.request('POST', 'put_blob_str', data='test-data') self.assertEqual(r.status_code, 200) diff --git a/tests/endtoend/timer_functions/timer_functions_stein/function_app.py b/tests/endtoend/timer_functions/timer_functions_stein/function_app.py index 0cd7f8ee1..25937d316 100644 --- a/tests/endtoend/timer_functions/timer_functions_stein/function_app.py +++ b/tests/endtoend/timer_functions/timer_functions_stein/function_app.py @@ -5,7 +5,7 @@ import azure.functions as func -app = func.FunctionApp() +app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @app.function_name(name="mytimer") diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 96f66f71d..db3bfb959 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -1,4 +1,3 @@ -import configparser import os import re import subprocess @@ -9,7 +8,7 @@ import requests -from tests.utils.constants import PROJECT_ROOT, TESTS_ROOT, WORKER_CONFIG +from tests.utils.constants import PROJECT_ROOT, TESTS_ROOT _DOCKER_PATH = "DOCKER_PATH" _DOCKER_DEFAULT_PATH = "docker" @@ -99,39 +98,35 @@ def create_container(self, image_repo: str, image_url: str, function_path = "/home/site/wwwroot" - env = {"FUNCTIONS_EXTENSION_VERSION": "4", - "FUNCTIONS_WORKER_RUNTIME": "python", - "FUNCTIONS_WORKER_RUNTIME_VERSION": _python_version, - "WEBSITE_SITE_NAME": _uuid, - "WEBSITE_HOSTNAME": f"{_uuid}.azurewebsites.com"} - - testconfig = None - storage_key: str = os.getenv("AzureWebJobsStorage") - if not storage_key and WORKER_CONFIG.exists(): - testconfig = configparser.ConfigParser() - testconfig.read(WORKER_CONFIG) - - if testconfig and 'azure' in testconfig: - storage_key = testconfig['azure'].get('storage_key') - - if not storage_key: - raise RuntimeError('Environment variable AzureWebJobsStorage ' - 'is required before running docker test') - run_cmd = [] run_cmd.extend([_docker_cmd, "run", "-p", "0:80", "-d"]) run_cmd.extend(["--name", _uuid, "--privileged"]) run_cmd.extend(["--cap-add", "SYS_ADMIN"]) run_cmd.extend(["--device", "/dev/fuse"]) run_cmd.extend(["-e", f"CONTAINER_NAME={_uuid}"]) - run_cmd.extend(["-e", f"AzureWebJobsStorage={storage_key}"]) + run_cmd.extend(["-e", f"AzureWebJobsStorage=" + f"{os.getenv('AzureWebJobsStorage')}"]) + run_cmd.extend(["-e", f"AzureWebJobsEventHubConnectionString=" + f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) + run_cmd.extend(["-e", f"AzureWebJobsCosmosDBConnectionString=" + f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}"]) + run_cmd.extend(["-e", f"AzureWebJobsServiceBusConnectionString=" + f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) + run_cmd.extend(["-e", f"AzureWebJobsEventHubConnectionString=" + f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) + run_cmd.extend(["-e", f"AzureWebJobsSqlConnectionString=" + f"{os.getenv('AzureWebJobsSqlConnectionString')}"]) + run_cmd.extend(["-e", f"AzureWebJobsEventGridTopicUri=" + f"{os.getenv('AzureWebJobsEventGridTopicUri')}"]) + run_cmd.extend(["-e", f"AzureWebJobsEventGridConnectionKey=" + f"{os.getenv('AzureWebJobsEventGridConnectionKey')}"]) + run_cmd.extend(["-e", f"AzureFunctionsWebHost__hostid={_uuid}"]) run_cmd.extend(["-v", f'{worker_path}:{container_worker_path}']) run_cmd.extend(["-v", f'{script_path}:{function_path}']) run_cmd.append(image) run_process = subprocess.run(args=run_cmd, - env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) From 232ae03079bcb26bc3a63465609fbeb00f88e1e5 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 1 Mar 2023 17:24:14 -0600 Subject: [PATCH 02/38] Installing libraries in the container --- tests/utils/testutils_docker.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index db3bfb959..91ce5e4c6 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -149,8 +149,21 @@ def create_container(self, image_repo: str, image_url: str, port_number = port_process.stdout.decode().strip('\n').split(':')[-1] # Wait for six seconds for the container to be in ready state - sleep(10) + sleep(6) self._addr = f'http://localhost:{port_number}' + + install_libraries_cmd = [_docker_cmd, "exec", _uuid] + install_libraries_cmd.extend(["pip", "install"]) + install_libraries_cmd.extend(["python-dotenv", "plotly", + "scikit-learn", "opencv-python", + "pandas", "numpy", "flask", "fastapi"]) + + install_libraries_process = subprocess.run(args=install_libraries_cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + if install_libraries_process.returncode != 0: + raise RuntimeError('Failed to install libraries') + return WebHostProxy(run_process, self._addr) From 808d4333bb8cf873268f10c56287029219b8604f Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 13 Mar 2023 12:44:28 -0500 Subject: [PATCH 03/38] Fixing broken tests --- tests/endtoend/test_http_functions.py | 6 ++ .../test_third_party_http_functions.py | 5 ++ tests/utils/testutils.py | 14 ++- tests/utils/testutils_docker.py | 90 +++++++++++-------- 4 files changed, 75 insertions(+), 40 deletions(-) diff --git a/tests/endtoend/test_http_functions.py b/tests/endtoend/test_http_functions.py index 425ef0e4e..f4913d475 100644 --- a/tests/endtoend/test_http_functions.py +++ b/tests/endtoend/test_http_functions.py @@ -140,6 +140,12 @@ def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'http_functions' / \ 'common_libs_functions' + @classmethod + def get_libraries_to_install(cls): + return ['requests', 'python-dotenv', "plotly", "scikit-learn", + "opencv-python", "pandas", "numpy"] + + @testutils.retryable_test(3, 5) def test_numpy(self): r = self.webhost.request('GET', 'numpy_func', timeout=REQUEST_TIMEOUT_SEC) diff --git a/tests/endtoend/test_third_party_http_functions.py b/tests/endtoend/test_third_party_http_functions.py index be7da2bb8..b480c47c4 100644 --- a/tests/endtoend/test_third_party_http_functions.py +++ b/tests/endtoend/test_third_party_http_functions.py @@ -51,6 +51,11 @@ def tearDownClass(cls): def get_script_dir(cls): pass + @classmethod + def get_libraries_to_install(cls): + libraries_required = ["flask", "fastapi"] + return libraries_required + @utils.retryable_test(3, 5) def test_function_index_page_should_return_undefined(self): root_url = self.webhost._addr diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index 0df17e2d8..f012ac100 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -211,9 +211,14 @@ class WebHostTestCase(unittest.TestCase, metaclass=WebHostTestCaseMeta): def get_script_dir(cls): raise NotImplementedError + @classmethod + def get_libraries_to_install(cls): + pass + @classmethod def setUpClass(cls): script_dir = pathlib.Path(cls.get_script_dir()) + libraries = cls.get_libraries_to_install() if is_envvar_true(PYAZURE_WEBHOST_DEBUG): cls.host_stdout = None else: @@ -221,9 +226,11 @@ def setUpClass(cls): try: if is_envvar_true(CONSUMPTION_DOCKER_TEST): - cls.webhost = WebHostConsumption(script_dir).spawn_container() + cls.webhost = \ + WebHostConsumption(script_dir, libraries).spawn_container() elif is_envvar_true(DEDICATED_DOCKER_TEST): - cls.webhost = WebHostDedicated(script_dir).spawn_container() + cls.webhost = \ + WebHostDedicated(script_dir, libraries).spawn_container() else: _setup_func_app(TESTS_ROOT / script_dir) cls.webhost = start_webhost(script_dir=script_dir, @@ -1001,9 +1008,10 @@ def _teardown_func_app(app_root): host_json = app_root / 'host.json' extensions_csproj_file = app_root / 'extensions.csproj' extensions_obj_file = app_root / 'obj' + libraries_path = app_root / '.python_packages' for path in (extensions, host_json, extensions_csproj_file, - extensions_obj_file): + extensions_obj_file, libraries_path): remove_path(path) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 91ce5e4c6..0f47d5fae 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -2,6 +2,7 @@ import re import subprocess import sys +import typing import unittest import uuid from time import sleep @@ -16,6 +17,7 @@ _docker_cmd = os.getenv(_DOCKER_PATH, _DOCKER_DEFAULT_PATH) _addr = "" _python_version = f'{sys.version_info.major}.{sys.version_info.minor}' +_libraries_path = '.python_packages/lib/site-packages' _uuid = str(uuid.uuid4()) _MESH_IMAGE_URL = "https://mcr.microsoft.com/v2/azure-functions/mesh/tags/list" _MESH_IMAGE_REPO = "mcr.microsoft.com/azure-functions/mesh" @@ -81,7 +83,7 @@ def find_latest_mesh_image(self, return image_tag def create_container(self, image_repo: str, image_url: str, - script_path: str): + script_path: str, libaries_to_install: typing.List): """Create a docker container and record its port. Create a docker container according to the image name. Return the port of container. """ @@ -98,40 +100,62 @@ def create_container(self, image_repo: str, image_url: str, function_path = "/home/site/wwwroot" + if libaries_to_install: + install_libraries_cmd = [] + install_libraries_cmd.extend(['pip', 'install']) + install_libraries_cmd.extend(libaries_to_install) + install_libraries_cmd.extend(['-t', + f'{script_path}/{_libraries_path}']) + + install_libraries_process = \ + subprocess.run(args=install_libraries_cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + if install_libraries_process.returncode != 0: + raise RuntimeError('Failed to install libraries') + run_cmd = [] run_cmd.extend([_docker_cmd, "run", "-p", "0:80", "-d"]) run_cmd.extend(["--name", _uuid, "--privileged"]) run_cmd.extend(["--cap-add", "SYS_ADMIN"]) run_cmd.extend(["--device", "/dev/fuse"]) run_cmd.extend(["-e", f"CONTAINER_NAME={_uuid}"]) - run_cmd.extend(["-e", f"AzureWebJobsStorage=" - f"{os.getenv('AzureWebJobsStorage')}"]) - run_cmd.extend(["-e", f"AzureWebJobsEventHubConnectionString=" - f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) - run_cmd.extend(["-e", f"AzureWebJobsCosmosDBConnectionString=" - f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}"]) - run_cmd.extend(["-e", f"AzureWebJobsServiceBusConnectionString=" - f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) - run_cmd.extend(["-e", f"AzureWebJobsEventHubConnectionString=" - f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) - run_cmd.extend(["-e", f"AzureWebJobsSqlConnectionString=" - f"{os.getenv('AzureWebJobsSqlConnectionString')}"]) - run_cmd.extend(["-e", f"AzureWebJobsEventGridTopicUri=" - f"{os.getenv('AzureWebJobsEventGridTopicUri')}"]) - run_cmd.extend(["-e", f"AzureWebJobsEventGridConnectionKey=" - f"{os.getenv('AzureWebJobsEventGridConnectionKey')}"]) + run_cmd.extend(["-e", + "AzureWebJobsStorage=" + f"{os.getenv('AzureWebJobsStorage')}"]) + run_cmd.extend(["-e", + "AzureWebJobsEventHubConnectionString=" + f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) + run_cmd.extend(["-e", + "AzureWebJobsCosmosDBConnectionString=" + f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}"]) + run_cmd.extend(["-e", + "AzureWebJobsServiceBusConnectionString=" + f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) + run_cmd.extend(["-e", + "AzureWebJobsEventHubConnectionString=" + f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) + run_cmd.extend(["-e", + "AzureWebJobsSqlConnectionString=" + f"{os.getenv('AzureWebJobsSqlConnectionString')}"]) + run_cmd.extend(["-e", + "AzureWebJobsEventGridTopicUri=" + f"{os.getenv('AzureWebJobsEventGridTopicUri')}"]) + run_cmd.extend(["-e", + "AzureWebJobsEventGridConnectionKey=" + f"{os.getenv('AzureWebJobsEventGridConnectionKey')}"]) run_cmd.extend(["-e", f"AzureFunctionsWebHost__hostid={_uuid}"]) - run_cmd.extend(["-v", f'{worker_path}:{container_worker_path}']) - run_cmd.extend(["-v", f'{script_path}:{function_path}']) + run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) + run_cmd.extend(["-v", f"{script_path}:{function_path}"]) run_cmd.append(image) - run_process = subprocess.run(args=run_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if run_process.returncode != 0: - raise RuntimeError('Failed to spawn docker container for' + raise RuntimeError('Failed to create docker container for' f' {image} with uuid {_uuid}.' f' stderr: {run_process.stderr}') @@ -152,37 +176,29 @@ def create_container(self, image_repo: str, image_url: str, sleep(6) self._addr = f'http://localhost:{port_number}' - install_libraries_cmd = [_docker_cmd, "exec", _uuid] - install_libraries_cmd.extend(["pip", "install"]) - install_libraries_cmd.extend(["python-dotenv", "plotly", - "scikit-learn", "opencv-python", - "pandas", "numpy", "flask", "fastapi"]) - - install_libraries_process = subprocess.run(args=install_libraries_cmd, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - if install_libraries_process.returncode != 0: - raise RuntimeError('Failed to install libraries') - return WebHostProxy(run_process, self._addr) class WebHostConsumption(WebHostDockerContainerBase): - def __init__(self, script_path: str): + def __init__(self, script_path: str, libraries_to_install=None): self.script_path = script_path + self.libraries_to_install = libraries_to_install def spawn_container(self): return self.create_container(_MESH_IMAGE_REPO, _MESH_IMAGE_URL, - self.script_path) + self.script_path, + self.libraries_to_install) class WebHostDedicated(WebHostDockerContainerBase): - def __init__(self, script_path: str): + def __init__(self, script_path: str, libraries_to_install=None): self.script_path = script_path + self.libraries_to_install = libraries_to_install def spawn_container(self): return self.create_container(_IMAGE_REPO, _IMAGE_URL, - self.script_path) + self.script_path, + self.libraries_to_install) From e014941bf211a0dda9706e22af2b9f9b8e13b36e Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 13 Mar 2023 17:01:05 -0500 Subject: [PATCH 04/38] Skipping check log tests --- .github/workflows/ci_docker_con_workflow.yml | 8 ++++---- .github/workflows/ci_docker_ded_workflow.yml | 8 ++++---- tests/utils/testutils.py | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 8a0dff868..425b22289 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -41,7 +41,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 --instafail tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -53,7 +53,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 --instafail tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -65,7 +65,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 --instafail tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -77,7 +77,7 @@ 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 + python -m pytest --instafail tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index d5ed8242f..ee000b0e8 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -46,7 +46,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 --instafail tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -58,7 +58,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 --instafail tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -70,7 +70,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 --instafail tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -82,7 +82,7 @@ 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 + python -m pytest --instafail tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index f012ac100..baf98b778 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -156,6 +156,10 @@ 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): + return super().__new__(mcls, name, bases, dct) + for attrname, attr in dct.items(): if attrname.startswith('test_') and callable(attr): test_case = attr From 370a7e1200d702847b6d2e26c5fe29b100ac0645 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 14 Mar 2023 13:50:19 -0500 Subject: [PATCH 05/38] Skipping dependency isolation tests for docker tests --- tests/endtoend/test_dependency_isolation_functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index 22e4d1344..94bd02b25 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -10,7 +10,7 @@ from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils -from tests.utils.constants import PYAZURE_INTEGRATION_TEST +from tests.utils.constants import PYAZURE_INTEGRATION_TEST, CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST REQUEST_TIMEOUT_SEC = 5 @@ -82,7 +82,9 @@ def test_working_directory_resolution(self): ) @skipIf( - is_envvar_true(PYAZURE_INTEGRATION_TEST), + is_envvar_true(PYAZURE_INTEGRATION_TEST) or + is_envvar_true(DEDICATED_DOCKER_TEST) or + is_envvar_true(CONSUMPTION_DOCKER_TEST), 'Integration test expects dependencies derived from core tools folder' ) def test_paths_resolution(self): From 20922183c73f3ceda17b89ebe91ef260a0d6b11f Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 29 Mar 2023 15:55:24 -0500 Subject: [PATCH 06/38] Adding worker indexing flag --- tests/utils/testutils_docker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 0f47d5fae..2c59166d7 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -121,6 +121,7 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["--cap-add", "SYS_ADMIN"]) run_cmd.extend(["--device", "/dev/fuse"]) run_cmd.extend(["-e", f"CONTAINER_NAME={_uuid}"]) + run_cmd.extend(["-e", f"AzureWebJobsFeatureFlags=EnableWorkerIndexing"]) run_cmd.extend(["-e", "AzureWebJobsStorage=" f"{os.getenv('AzureWebJobsStorage')}"]) From bf6e0fa5f01075e3442189c3672779b5028770ff Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 30 Mar 2023 11:57:01 -0500 Subject: [PATCH 07/38] Adding os.env to the docker container --- tests/endtoend/test_dependency_isolation_functions.py | 5 +++++ tests/utils/testutils_docker.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index 94bd02b25..8c22510de 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -68,6 +68,11 @@ def test_feature_flag_is_turned_on(self): flag_value = environments['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] self.assertEqual(flag_value, '1') + @skipIf( + is_envvar_true(DEDICATED_DOCKER_TEST) or + is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Docker test expects dependencies derived from agents folder" + ) def test_working_directory_resolution(self): """Check from the dependency manager and see if the current working directory is resolved correctly diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 2c59166d7..55d38f3e6 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -150,6 +150,9 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) run_cmd.extend(["-v", f"{script_path}:{function_path}"]) + for key, value in os.environ.items(): + run_cmd.extend(["-e", f"{key}={value}"]) + run_cmd.append(image) run_process = subprocess.run(args=run_cmd, stdout=subprocess.PIPE, From cee3ce8e76ccc8ff3d03b31905e42e2bd54c8492 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Fri, 31 Mar 2023 14:55:39 -0500 Subject: [PATCH 08/38] Added env variables to docker container --- .../test_dependency_isolation_functions.py | 39 +++++++++++-------- .../test_third_party_http_functions.py | 7 +--- ...test_threadpool_thread__count_functions.py | 7 +++- .../test_worker_proccess_count_functions.py | 12 +++++- tests/utils/testutils.py | 14 ++++++- tests/utils/testutils_docker.py | 25 ++++++++---- 6 files changed, 69 insertions(+), 35 deletions(-) diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index 8c22510de..270d3093a 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -10,7 +10,8 @@ from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils -from tests.utils.constants import PYAZURE_INTEGRATION_TEST, CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST +from tests.utils.constants import PYAZURE_INTEGRATION_TEST, \ + CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST REQUEST_TIMEOUT_SEC = 5 @@ -29,15 +30,19 @@ class TestGRPCandProtobufDependencyIsolationOnDedicated( package_name = '.python_packages_grpc_protobuf' project_root = testutils.E2E_TESTS_ROOT / function_name customer_deps = project_root / package_name / 'lib' / 'site-packages' + env_variables = {} @classmethod def setUpClass(cls): - os_environ = os.environ.copy() # Turn on feature flag - os_environ['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] = '1' + cls.env_variables['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] = '1' + # Emulate Python worker in Azure environment. - # For how the PYTHONPATH is set in Azure, check prodV3/worker.py. - os_environ['PYTHONPATH'] = str(cls.customer_deps) + # For how the PYTHONPATH is set in Azure, check prodV4/worker.py. + cls.env_variables['PYTHONPATH'] = str(cls.customer_deps) + + os_environ = os.environ.copy() + os_environ.update(cls.env_variables) cls._patch_environ = patch.dict('os.environ', os_environ) cls._patch_environ.start() @@ -52,6 +57,10 @@ def tearDownClass(self): def get_script_dir(cls): return cls.project_root + @classmethod + def get_environment_variables(cls): + return cls.env_variables + def test_dependency_function_should_return_ok(self): """The common scenario of general import should return OK in any circumstances @@ -68,11 +77,10 @@ def test_feature_flag_is_turned_on(self): flag_value = environments['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] self.assertEqual(flag_value, '1') - @skipIf( - is_envvar_true(DEDICATED_DOCKER_TEST) or - is_envvar_true(CONSUMPTION_DOCKER_TEST), - "Docker test expects dependencies derived from agents folder" - ) + @skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Docker test expects dependencies derived from agents folder" + ) def test_working_directory_resolution(self): """Check from the dependency manager and see if the current working directory is resolved correctly @@ -86,12 +94,11 @@ def test_working_directory_resolution(self): os.path.join(dir, 'dependency_isolation_functions').lower() ) - @skipIf( - is_envvar_true(PYAZURE_INTEGRATION_TEST) or - is_envvar_true(DEDICATED_DOCKER_TEST) or - is_envvar_true(CONSUMPTION_DOCKER_TEST), - 'Integration test expects dependencies derived from core tools folder' - ) + @skipIf(is_envvar_true(PYAZURE_INTEGRATION_TEST) + or is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + 'Integration test expects dependencies derived from core ' + 'tools folder') def test_paths_resolution(self): """Dependency manager requires paths to be resolved correctly before switching to customer's modules. This test is to ensure when the app diff --git a/tests/endtoend/test_third_party_http_functions.py b/tests/endtoend/test_third_party_http_functions.py index b480c47c4..6735bef92 100644 --- a/tests/endtoend/test_third_party_http_functions.py +++ b/tests/endtoend/test_third_party_http_functions.py @@ -1,9 +1,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os -from unittest.mock import patch import requests + from tests.utils import testutils as utils from tests.utils.testutils import E2E_TESTS_ROOT @@ -35,11 +35,6 @@ def setUpClass(cls): host_json = cls.get_script_dir() / 'host.json' with open(host_json, 'w+') as f: f.write(HOST_JSON_TEMPLATE) - os_environ = os.environ.copy() - # Turn on feature flag - os_environ['AzureWebJobsFeatureFlags'] = 'EnableWorkerIndexing' - cls._patch_environ = patch.dict('os.environ', os_environ) - cls._patch_environ.start() super().setUpClass() @classmethod diff --git a/tests/endtoend/test_threadpool_thread__count_functions.py b/tests/endtoend/test_threadpool_thread__count_functions.py index 42c33eaff..ada5c10b4 100644 --- a/tests/endtoend/test_threadpool_thread__count_functions.py +++ b/tests/endtoend/test_threadpool_thread__count_functions.py @@ -14,10 +14,15 @@ class TestPythonThreadpoolThreadCount(testutils.WebHostTestCase): scenarios. """ + env_variables = {} + @classmethod def setUpClass(cls): + cls.env_variables['PYTHON_THREADPOOL_THREAD_COUNT'] = '2' + os_environ = os.environ.copy() - os_environ['PYTHON_THREADPOOL_THREAD_COUNT'] = '2' + os_environ.update(cls.env_variables) + cls._patch_environ = patch.dict('os.environ', os_environ) cls._patch_environ.start() super().setUpClass() diff --git a/tests/endtoend/test_worker_proccess_count_functions.py b/tests/endtoend/test_worker_proccess_count_functions.py index 35e72fb48..f8a82fe67 100644 --- a/tests/endtoend/test_worker_proccess_count_functions.py +++ b/tests/endtoend/test_worker_proccess_count_functions.py @@ -13,12 +13,16 @@ class TestWorkerProcessCount(testutils.WebHostTestCase): same time. this file is more focused on testing the E2E flow scenario for FUNCTIONS_WORKER_PROCESS_COUNT feature. """ + env_variables = {} @classmethod def setUpClass(cls): + cls.env_variables['PYTHON_THREADPOOL_THREAD_COUNT'] = '1' + cls.env_variables['FUNCTIONS_WORKER_PROCESS_COUNT'] = '2' + os_environ = os.environ.copy() - os_environ['PYTHON_THREADPOOL_THREAD_COUNT'] = '1' - os_environ['FUNCTIONS_WORKER_PROCESS_COUNT'] = '2' + os_environ.update(cls.env_variables) + cls._patch_environ = patch.dict('os.environ', os_environ) cls._patch_environ.start() super().setUpClass() @@ -31,6 +35,10 @@ def tearDown(self): def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'http_functions' + @classmethod + def get_environment_variables(cls): + return cls.env_variables + @testutils.retryable_test(3, 5) def test_http_func_with_worker_process_count_2(self): response = [None, None] diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index baf98b778..765ac209d 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -219,10 +219,16 @@ def get_script_dir(cls): def get_libraries_to_install(cls): pass + @classmethod + def get_environment_variables(cls): + pass + @classmethod def setUpClass(cls): script_dir = pathlib.Path(cls.get_script_dir()) libraries = cls.get_libraries_to_install() + env_variables = cls.get_environment_variables() + if is_envvar_true(PYAZURE_WEBHOST_DEBUG): cls.host_stdout = None else: @@ -231,10 +237,14 @@ def setUpClass(cls): try: if is_envvar_true(CONSUMPTION_DOCKER_TEST): cls.webhost = \ - WebHostConsumption(script_dir, libraries).spawn_container() + WebHostConsumption(script_dir, + libraries, + env_variables).spawn_container() elif is_envvar_true(DEDICATED_DOCKER_TEST): cls.webhost = \ - WebHostDedicated(script_dir, libraries).spawn_container() + WebHostDedicated(script_dir, + libraries, + env_variables).spawn_container() else: _setup_func_app(TESTS_ROOT / script_dir) cls.webhost = start_webhost(script_dir=script_dir, diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 55d38f3e6..7cdc751fe 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -83,7 +83,8 @@ def find_latest_mesh_image(self, return image_tag def create_container(self, image_repo: str, image_url: str, - script_path: str, libaries_to_install: typing.List): + script_path: str, libaries_to_install: typing.List, + env: typing.Dict): """Create a docker container and record its port. Create a docker container according to the image name. Return the port of container. """ @@ -121,7 +122,7 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["--cap-add", "SYS_ADMIN"]) run_cmd.extend(["--device", "/dev/fuse"]) run_cmd.extend(["-e", f"CONTAINER_NAME={_uuid}"]) - run_cmd.extend(["-e", f"AzureWebJobsFeatureFlags=EnableWorkerIndexing"]) + run_cmd.extend(["-e", "AzureWebJobsFeatureFlags=EnableWorkerIndexing"]) run_cmd.extend(["-e", "AzureWebJobsStorage=" f"{os.getenv('AzureWebJobsStorage')}"]) @@ -133,7 +134,7 @@ def create_container(self, image_repo: str, image_url: str, f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}"]) run_cmd.extend(["-e", "AzureWebJobsServiceBusConnectionString=" - f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) + f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) # NoQA run_cmd.extend(["-e", "AzureWebJobsEventHubConnectionString=" f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) @@ -150,7 +151,7 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) run_cmd.extend(["-v", f"{script_path}:{function_path}"]) - for key, value in os.environ.items(): + for key, value in env.items(): run_cmd.extend(["-e", f"{key}={value}"]) run_cmd.append(image) @@ -185,24 +186,32 @@ def create_container(self, image_repo: str, image_url: str, class WebHostConsumption(WebHostDockerContainerBase): - def __init__(self, script_path: str, libraries_to_install=None): + def __init__(self, script_path: str, + libraries_to_install: typing.List = None, + env: typing.Dict = None): self.script_path = script_path self.libraries_to_install = libraries_to_install + self.env = env def spawn_container(self): return self.create_container(_MESH_IMAGE_REPO, _MESH_IMAGE_URL, self.script_path, - self.libraries_to_install) + self.libraries_to_install, + self.env) class WebHostDedicated(WebHostDockerContainerBase): - def __init__(self, script_path: str, libraries_to_install=None): + def __init__(self, script_path: str, + libraries_to_install: typing.List = None, + env: typing.Dict = None): self.script_path = script_path self.libraries_to_install = libraries_to_install + self.env = env def spawn_container(self): return self.create_container(_IMAGE_REPO, _IMAGE_URL, self.script_path, - self.libraries_to_install) + self.libraries_to_install, + self.env) From 305ad08880f5ee8724478bcb1a55507704c6c7ec Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 3 Apr 2023 13:19:28 -0500 Subject: [PATCH 09/38] None check for env --- tests/utils/testutils_docker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 7cdc751fe..bae37e176 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -151,8 +151,9 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) run_cmd.extend(["-v", f"{script_path}:{function_path}"]) - for key, value in env.items(): - run_cmd.extend(["-e", f"{key}={value}"]) + if env: + for key, value in env.items(): + run_cmd.extend(["-e", f"{key}={value}"]) run_cmd.append(image) run_process = subprocess.run(args=run_cmd, From 8779b32fbe4579ebe5fc7d738aba6e8db842a4fd Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 3 Apr 2023 13:46:25 -0500 Subject: [PATCH 10/38] Added retries --- .github/workflows/ci_docker_ded_workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index ee000b0e8..fac489c6f 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -46,7 +46,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} run: | - python -m pytest --instafail tests/endtoend + python -m pytest --instafail --reruns 4 -vv tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -58,7 +58,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} run: | - python -m pytest --instafail tests/endtoend + python -m pytest --instafail --reruns 4 -vv tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -70,7 +70,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} run: | - python -m pytest --instafail tests/endtoend + python -m pytest --instafail --reruns 4 -vv tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -82,7 +82,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} run: | - python -m pytest --instafail tests/endtoend + python -m pytest --instafail --reruns 4 -vv tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: From d0a39ba59778eaec887d0a255b506041d830f9f1 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 3 Apr 2023 14:18:00 -0500 Subject: [PATCH 11/38] Removing unused variable --- tests/endtoend/test_third_party_http_functions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/endtoend/test_third_party_http_functions.py b/tests/endtoend/test_third_party_http_functions.py index 6735bef92..8f6b555a9 100644 --- a/tests/endtoend/test_third_party_http_functions.py +++ b/tests/endtoend/test_third_party_http_functions.py @@ -40,7 +40,6 @@ def setUpClass(cls): @classmethod def tearDownClass(cls): super().tearDownClass() - cls._patch_environ.stop() @classmethod def get_script_dir(cls): From c6e028c5e2cccc674a485026de5574af4a3f203f Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 4 Apr 2023 15:29:01 -0500 Subject: [PATCH 12/38] Refactored and fixed flaky tests --- tests/endtoend/test_blob_functions.py | 28 +++++-------- .../test_dependency_isolation_functions.py | 3 ++ tests/utils/testutils.py | 17 ++++---- tests/utils/testutils_docker.py | 41 ++++++++++--------- 4 files changed, 42 insertions(+), 47 deletions(-) diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index 2d22a88ab..d55ebeb8b 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -107,14 +107,10 @@ def test_blob_trigger(self): self.assertEqual(r.status_code, 200) response = r.json() - self.assertEqual( - response, - { - 'name': 'python-worker-tests/test-blob-trigger.txt', - 'length': len(data), - 'content': data - } - ) + self.assertEqual(response['name'], + 'python-worker-tests/test-blob-trigger.txt') + self.assertEqual(response['content'], data) + break except AssertionError: if try_no == max_retries - 1: @@ -132,22 +128,18 @@ def test_blob_trigger_with_large_content(self): # We check it every 2 seconds to allow the trigger to be fired max_retries = 10 for try_no in range(max_retries): - time.sleep(2) - try: # Check that the trigger has fired r = self.webhost.request('GET', 'get_blob_triggered') + time.sleep(2) + self.assertEqual(r.status_code, 200) response = r.json() - self.assertEqual( - response, - { - 'name': 'python-worker-tests/test-blob-trigger.txt', - 'length': len(data), - 'content': data - } - ) + self.assertEqual(response['name'], + 'python-worker-tests/test-blob-trigger.txt') + self.assertEqual(response['content'], data) + break except AssertionError: if try_no == max_retries - 1: diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index 270d3093a..f01d30a17 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -122,6 +122,9 @@ def test_paths_resolution(self): ).lower() ) + @skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + 'Docker tests do not work with dependency isolation ') def test_loading_libraries_from_customers_package(self): """Since the Python now loaded the customer's dependencies, the libraries version should match the ones in diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index 765ac209d..593bf5906 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -49,7 +49,7 @@ from tests.utils.constants import PYAZURE_WORKER_DIR, \ PYAZURE_INTEGRATION_TEST, PROJECT_ROOT, WORKER_CONFIG, \ CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST, PYAZURE_WEBHOST_DEBUG -from tests.utils.testutils_docker import WebHostConsumption, WebHostDedicated +from tests.utils.testutils_docker import WebHostConsumption, WebHostDedicated, DockerConfigs TESTS_ROOT = PROJECT_ROOT / 'tests' E2E_TESTS_FOLDER = pathlib.Path('endtoend') @@ -226,8 +226,11 @@ def get_environment_variables(cls): @classmethod def setUpClass(cls): script_dir = pathlib.Path(cls.get_script_dir()) - libraries = cls.get_libraries_to_install() - env_variables = cls.get_environment_variables() + + docker_configs = DockerConfigs + docker_configs.script_path = script_dir + docker_configs.libraries = cls.get_libraries_to_install() + docker_configs.env = cls.get_environment_variables() if is_envvar_true(PYAZURE_WEBHOST_DEBUG): cls.host_stdout = None @@ -237,14 +240,10 @@ def setUpClass(cls): try: if is_envvar_true(CONSUMPTION_DOCKER_TEST): cls.webhost = \ - WebHostConsumption(script_dir, - libraries, - env_variables).spawn_container() + WebHostConsumption(docker_configs).spawn_container() elif is_envvar_true(DEDICATED_DOCKER_TEST): cls.webhost = \ - WebHostDedicated(script_dir, - libraries, - env_variables).spawn_container() + WebHostDedicated(docker_configs).spawn_container() else: _setup_func_app(TESTS_ROOT / script_dir) cls.webhost = start_webhost(script_dir=script_dir, diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index bae37e176..e9b777487 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -5,6 +5,7 @@ import typing import unittest import uuid +from dataclasses import dataclass from time import sleep import requests @@ -25,6 +26,13 @@ _IMAGE_REPO = "mcr.microsoft.com/azure-functions/python" +@dataclass +class DockerConfigs: + script_path: str + libraries: typing.List = None + env: typing.Dict = None + + class WebHostProxy: def __init__(self, proc, addr): @@ -52,9 +60,9 @@ def close(self) -> bool: class WebHostDockerContainerBase(unittest.TestCase): - def find_latest_mesh_image(self, - image_repo: str, - image_url: str) -> str: + @staticmethod + def find_latest_image(image_repo: str, + image_url: str) -> str: regex = re.compile(_HOST_VERSION + r'.\d+.\d+-python' + _python_version) @@ -83,16 +91,15 @@ def find_latest_mesh_image(self, return image_tag def create_container(self, image_repo: str, image_url: str, - script_path: str, libaries_to_install: typing.List, - env: typing.Dict): + configs: DockerConfigs): """Create a docker container and record its port. Create a docker container according to the image name. Return the port of container. """ worker_path = os.path.join(PROJECT_ROOT, 'azure_functions_worker') - script_path = os.path.join(TESTS_ROOT, script_path) + script_path = os.path.join(TESTS_ROOT, configs.script_path) - image = self.find_latest_mesh_image(image_repo, image_url) + image = self.find_latest_image(image_repo, image_url) container_worker_path = ( f"/azure-functions-host/workers/python/{_python_version}/" @@ -101,10 +108,10 @@ def create_container(self, image_repo: str, image_url: str, function_path = "/home/site/wwwroot" - if libaries_to_install: + if configs.libraries: install_libraries_cmd = [] install_libraries_cmd.extend(['pip', 'install']) - install_libraries_cmd.extend(libaries_to_install) + install_libraries_cmd.extend(configs.libraries) install_libraries_cmd.extend(['-t', f'{script_path}/{_libraries_path}']) @@ -151,8 +158,8 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) run_cmd.extend(["-v", f"{script_path}:{function_path}"]) - if env: - for key, value in env.items(): + if configs.env: + for key, value in configs.env.items(): run_cmd.extend(["-e", f"{key}={value}"]) run_cmd.append(image) @@ -204,15 +211,9 @@ def spawn_container(self): class WebHostDedicated(WebHostDockerContainerBase): - def __init__(self, script_path: str, - libraries_to_install: typing.List = None, - env: typing.Dict = None): - self.script_path = script_path - self.libraries_to_install = libraries_to_install - self.env = env + def __init__(self, configs: DockerConfigs): + self.configs = configs def spawn_container(self): return self.create_container(_IMAGE_REPO, _IMAGE_URL, - self.script_path, - self.libraries_to_install, - self.env) + self.configs) From 2c7814ecd4858b5ce746c3cf8d1f3c24e823d7f4 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 5 Apr 2023 11:06:18 -0500 Subject: [PATCH 13/38] Skipping durable and table tests --- tests/endtoend/test_durable_functions.py | 24 ++++++++++++++++++++++++ tests/endtoend/test_table_functions.py | 12 ++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tests/endtoend/test_durable_functions.py b/tests/endtoend/test_durable_functions.py index 76e75ab65..cf0538142 100644 --- a/tests/endtoend/test_durable_functions.py +++ b/tests/endtoend/test_durable_functions.py @@ -1,9 +1,33 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from unittest import skipIf + +from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils +from tests.utils.constants import DEDICATED_DOCKER_TEST, \ + CONSUMPTION_DOCKER_TEST +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Docker container cannot set webhook required " + "for durable tests") class TestDurableFunctions(testutils.WebHostTestCase): + env_variables = {} + + @classmethod + def setUpClass(cls): + # webhook for durable tests + cls.env_variables['WEBSITE_HOSTNAME'] = "http://*:8080" + super().setUpClass() + + @classmethod + def get_libraries_to_install(cls): + return ['azure-functions-durable'] + + @classmethod + def get_environment_variables(cls): + return cls.env_variables @classmethod def get_script_dir(cls): diff --git a/tests/endtoend/test_table_functions.py b/tests/endtoend/test_table_functions.py index 81488e314..9c081e8d6 100644 --- a/tests/endtoend/test_table_functions.py +++ b/tests/endtoend/test_table_functions.py @@ -3,10 +3,18 @@ import json import pathlib import time +from unittest import skipIf +from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils +from tests.utils.constants import DEDICATED_DOCKER_TEST, \ + CONSUMPTION_DOCKER_TEST +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Table functions has a bug with the table extension 1.0.0." + "https://github.com/Azure/azure-sdk-for-net/issues/33902.") class TestTableFunctions(testutils.WebHostTestCase): @classmethod @@ -56,6 +64,10 @@ def test_table_bindings(self): self.assertEqual(in_row_key, row_key) +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Table functions has a bug with the table extension 1.0.0." + "https://github.com/Azure/azure-sdk-for-net/issues/33902.") class TestTableFunctionsGeneric(TestTableFunctionsStein): @classmethod From fb68c372066f856c690f9acdcf24741e80554c80 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 6 Apr 2023 12:06:55 -0500 Subject: [PATCH 14/38] Installing azure-eventhub in the docker container --- tests/endtoend/test_eventhub_functions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index dd830b538..a0005423a 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -22,6 +22,10 @@ class TestEventHubFunctions(testutils.WebHostTestCase): def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'eventhub_functions' + @classmethod + def get_libraries_to_install(cls): + return ['azure-eventhub'] + def test_eventhub_trigger(self): # Generate a unique event body for the EventHub event data = str(round(time.time())) From b3510cd1072bd68bf863aa2527773a02b3d394ff Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 6 Apr 2023 13:56:22 -0500 Subject: [PATCH 15/38] Fix eventhub function.json --- .../get_eventhub_batch_triggered/function.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json b/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json index e1ece825c..3f68bfc1b 100644 --- a/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json +++ b/tests/endtoend/eventhub_batch_functions/get_eventhub_batch_triggered/function.json @@ -8,8 +8,8 @@ "methods": [ "get" ], - "name": "req", - }", + "name": "req" + }, { "direction": "in", "type": "table", From 23dc5e6735ce6a292ac29830be67e8eed3ea9230 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 6 Apr 2023 16:31:02 -0500 Subject: [PATCH 16/38] Added eventhub library --- .github/workflows/ci_consumption_workflow.yml | 8 ++--- .github/workflows/ci_docker_con_workflow.yml | 5 ++++ .github/workflows/ci_docker_ded_workflow.yml | 9 +++--- codecov.yml | 4 +-- .../endtoend/test_eventhub_batch_functions.py | 4 +++ tests/endtoend/test_table_functions.py | 7 ++++- tests/utils/testutils.py | 29 ++++++++++--------- 7 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci_consumption_workflow.yml b/.github/workflows/ci_consumption_workflow.yml index 22a83a20d..0db28c59b 100644 --- a/.github/workflows/ci_consumption_workflow.yml +++ b/.github/workflows/ci_consumption_workflow.yml @@ -33,19 +33,19 @@ jobs: 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 --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 --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 --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 --reruns 4 --instafail tests/consumption_tests diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 425b22289..d96b4d7f3 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -8,11 +8,16 @@ on: # 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" + issue_comment: + types: [ created ] + pull_request_review_comment: + types: [ created ] jobs: build: name: "Python Docker CI Run" runs-on: ubuntu-latest + if: github.event_name == 'schedule' || contains(github.event.issue.body, '/run-docker-tests') strategy: fail-fast: false matrix: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index fac489c6f..a1e431247 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -5,19 +5,20 @@ name: CI Docker Dedicated tests on: workflow_dispatch: - push: - branches: [ dev, master, main, release/* ] - pull_request: - branches: [ dev, master, main, release/* ] 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" + issue_comment: + types: [ created ] + pull_request_review_comment: + types: [ created ] jobs: build: name: "Python Docker CI Run" runs-on: ubuntu-latest + if: github.event_name == 'schedule' || contains(github.event.issue.body, '/run-docker-tests') strategy: fail-fast: false matrix: diff --git a/codecov.yml b/codecov.yml index 60f152a79..1881fd7dd 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,3 @@ ignore: - - "tests/utils/testutils.py" - - "tests/utils/testutils_lc.py" + - "tests/utils/" + diff --git a/tests/endtoend/test_eventhub_batch_functions.py b/tests/endtoend/test_eventhub_batch_functions.py index 27fc04fcc..22456ab22 100644 --- a/tests/endtoend/test_eventhub_batch_functions.py +++ b/tests/endtoend/test_eventhub_batch_functions.py @@ -22,6 +22,10 @@ class TestEventHubFunctions(testutils.WebHostTestCase): def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'eventhub_batch_functions' + @classmethod + def get_libraries_to_install(cls): + return ['azure-eventhub'] + def test_eventhub_multiple(self): NUM_EVENTS = 3 all_row_keys_seen = dict([(str(i), True) for i in range(NUM_EVENTS)]) diff --git a/tests/endtoend/test_table_functions.py b/tests/endtoend/test_table_functions.py index 9c081e8d6..c9290e1ea 100644 --- a/tests/endtoend/test_table_functions.py +++ b/tests/endtoend/test_table_functions.py @@ -46,6 +46,10 @@ def test_table_bindings(self): self.assertEqual(in_row_key, row_key) +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Table functions has a bug with the table extension 1.0.0." + "https://github.com/Azure/azure-sdk-for-net/issues/33902.") class TestTableFunctionsStein(testutils.WebHostTestCase): @classmethod @@ -73,4 +77,5 @@ class TestTableFunctionsGeneric(TestTableFunctionsStein): @classmethod def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'table_functions' / \ - 'table_functions_stein' / 'generic' + 'table_functions_stein' /\ + 'generic' diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index 593bf5906..1dfeca0aa 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -49,7 +49,8 @@ from tests.utils.constants import PYAZURE_WORKER_DIR, \ PYAZURE_INTEGRATION_TEST, PROJECT_ROOT, WORKER_CONFIG, \ CONSUMPTION_DOCKER_TEST, DEDICATED_DOCKER_TEST, PYAZURE_WEBHOST_DEBUG -from tests.utils.testutils_docker import WebHostConsumption, WebHostDedicated, DockerConfigs +from tests.utils.testutils_docker import WebHostConsumption, WebHostDedicated, \ + DockerConfigs TESTS_ROOT = PROJECT_ROOT / 'tests' E2E_TESTS_FOLDER = pathlib.Path('endtoend') @@ -136,7 +137,7 @@ class AsyncTestCaseMeta(type(unittest.TestCase)): def __new__(mcls, name, bases, ns): for attrname, attr in ns.items(): if (attrname.startswith('test_') - and inspect.iscoroutinefunction(attr)): + and inspect.iscoroutinefunction(attr)): ns[attrname] = mcls._sync_wrap(attr) return super().__new__(mcls, name, bases, ns) @@ -146,6 +147,7 @@ def _sync_wrap(func): @functools.wraps(func) def wrapper(*args, **kwargs): return aio_compat.run(func(*args, **kwargs)) + return wrapper @@ -294,6 +296,7 @@ class SharedMemoryTestCase(unittest.TestCase): """ For tests involving shared memory data transfer usage. """ + def setUp(self): self.was_shmem_env_true = is_envvar_true( FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED) @@ -392,9 +395,8 @@ def _setUpDarwin(self): self._createSharedMemoryDirectories(self.created_directories) # Override the AppSetting for the duration of this test so the # FileAccessorUnix can use these directories for creating memory maps - os.environ.update( - {UNIX_SHARED_MEMORY_DIRECTORIES: - ','.join(self.created_directories)}) + os.environ.update({UNIX_SHARED_MEMORY_DIRECTORIES: + ','.join(self.created_directories)}) def _tearDownDarwin(self): # Delete the directories containing shared memory maps @@ -410,7 +412,6 @@ def _tearDownDarwin(self): class _MockWebHostServicer(protos.FunctionRpcServicer): - _STOP = object() def __init__(self, host): @@ -620,9 +621,9 @@ async def close_shared_memory_resources( return r async def reload_environment( - self, - environment: typing.Dict[str, str], - function_project_path: str = '/home/site/wwwroot' + self, + environment: typing.Dict[str, str], + function_project_path: str = '/home/site/wwwroot' ) -> protos.FunctionEnvironmentReloadResponse: request_content = protos.FunctionEnvironmentReloadRequest( @@ -707,7 +708,7 @@ async def __aenter__(self) -> _MockWebHost: await self._host.start() - self._worker = await dispatcher.\ + self._worker = await dispatcher. \ Dispatcher.connect(LOCALHOST, self._host._port, self._host.worker_id, self._host.request_id, connect_timeout=5.0) @@ -962,9 +963,9 @@ def create_dummy_dispatcher(): def retryable_test( - number_of_retries: int, - interval_sec: int, - expected_exception: type = Exception + number_of_retries: int, + interval_sec: int, + expected_exception: type = Exception ): def decorate(func): def call(*args, **kwargs): @@ -978,7 +979,9 @@ def call(*args, **kwargs): raise e time.sleep(interval_sec) + return call + return decorate From c6dff729dea8a02d920c988bfd4bd1053edbbca6 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Sun, 9 Apr 2023 09:19:26 -0500 Subject: [PATCH 17/38] Docker comment workflow update --- .github/workflows/ci_docker_con_workflow.yml | 4 ++-- .github/workflows/ci_docker_ded_workflow.yml | 4 ++-- tests/utils/testutils.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index d96b4d7f3..016f7f5d8 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -9,9 +9,9 @@ on: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4" issue_comment: - types: [ created ] + types: [ created, edited] pull_request_review_comment: - types: [ created ] + types: [ created, edited] jobs: build: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index a1e431247..10595d5df 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -10,9 +10,9 @@ on: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4" issue_comment: - types: [ created ] + types: [ created, edited] pull_request_review_comment: - types: [ created ] + types: [ created, edited] jobs: build: diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index 1dfeca0aa..1b3762a40 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -395,8 +395,9 @@ def _setUpDarwin(self): self._createSharedMemoryDirectories(self.created_directories) # Override the AppSetting for the duration of this test so the # FileAccessorUnix can use these directories for creating memory maps - os.environ.update({UNIX_SHARED_MEMORY_DIRECTORIES: - ','.join(self.created_directories)}) + os.environ.update( + {UNIX_SHARED_MEMORY_DIRECTORIES: ','.join(self.created_directories)} + ) def _tearDownDarwin(self): # Delete the directories containing shared memory maps From d7ed2c6020693dc24a3c98e5a2525bf402294d09 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Sun, 9 Apr 2023 09:29:11 -0500 Subject: [PATCH 18/38] updated docker workflow to check for comment --- .github/workflows/ci_docker_con_workflow.yml | 2 +- .github/workflows/ci_docker_ded_workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 016f7f5d8..5cc903627 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -17,7 +17,7 @@ jobs: build: name: "Python Docker CI Run" runs-on: ubuntu-latest - if: github.event_name == 'schedule' || contains(github.event.issue.body, '/run-docker-tests') + if: github.event_name == 'schedule' || contains(github.event.comment.body, '/run-docker-tests') strategy: fail-fast: false matrix: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 10595d5df..275368829 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -18,7 +18,7 @@ jobs: build: name: "Python Docker CI Run" runs-on: ubuntu-latest - if: github.event_name == 'schedule' || contains(github.event.issue.body, '/run-docker-tests') + if: github.event_name == 'schedule' || contains(github.event.comment.body, '/run-docker-tests') strategy: fail-fast: false matrix: From b579a60a7a66d53e8dcdf920171cb03d6b7ed86f Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 11 Apr 2023 13:34:58 -0500 Subject: [PATCH 19/38] Update github workflow --- .github/workflows/ci_docker_con_workflow.yml | 6 ++---- .github/workflows/ci_docker_ded_workflow.yml | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 5cc903627..9e538a36c 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -9,15 +9,13 @@ on: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4" issue_comment: - types: [ created, edited] - pull_request_review_comment: - types: [ created, edited] + types: [created, edited] jobs: build: name: "Python Docker CI Run" + if: ${{ contains(github.event.comment.body, 'run-docker-tests') || github.event_name == 'schedule' }} runs-on: ubuntu-latest - if: github.event_name == 'schedule' || contains(github.event.comment.body, '/run-docker-tests') strategy: fail-fast: false matrix: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 275368829..d8d7653c4 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -1,6 +1,5 @@ # This workflow will run all tests in endtoend/tests in a docker container using the latest dedicated image - name: CI Docker Dedicated tests on: @@ -10,15 +9,13 @@ on: # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4" issue_comment: - types: [ created, edited] - pull_request_review_comment: - types: [ created, edited] + types: [created, edited] jobs: build: name: "Python Docker CI Run" + if: ${{ contains(github.event.comment.body, 'run-docker-tests') || github.event_name == 'schedule' }} runs-on: ubuntu-latest - if: github.event_name == 'schedule' || contains(github.event.comment.body, '/run-docker-tests') strategy: fail-fast: false matrix: From b8b7c231db24db94282181db84934e81e432617e Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 11 Apr 2023 16:54:54 -0500 Subject: [PATCH 20/38] Testing issue_comment --- .github/workflows/ci_docker_con_workflow.yml | 2 +- .github/workflows/ci_docker_ded_workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 9e538a36c..15583142c 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -14,7 +14,7 @@ on: jobs: build: name: "Python Docker CI Run" - if: ${{ contains(github.event.comment.body, 'run-docker-tests') || github.event_name == 'schedule' }} + if: contains(github.event.comment.body, '/run-docker-tests') || github.event_name == 'schedule' runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index d8d7653c4..4f0471c98 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -14,7 +14,7 @@ on: jobs: build: name: "Python Docker CI Run" - if: ${{ contains(github.event.comment.body, 'run-docker-tests') || github.event_name == 'schedule' }} + if: contains(github.event.comment.body, '/run-docker-tests') || github.event_name == 'schedule' runs-on: ubuntu-latest strategy: fail-fast: false From f299113478c5b62d5272798693e37113caa7336d Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 12 Apr 2023 11:14:28 -0500 Subject: [PATCH 21/38] Issue comment test --- .github/workflows/ci_docker_con_workflow.yml | 2 +- .github/workflows/ci_docker_ded_workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 15583142c..b8cf81140 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -14,7 +14,7 @@ on: jobs: build: name: "Python Docker CI Run" - if: contains(github.event.comment.body, '/run-docker-tests') || github.event_name == 'schedule' + if: ${{ (github.event.issue.pull_request && github.event.comment.body == '/run-docker-tests') || github.event_name == 'schedule' }} runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 4f0471c98..fb29fec9e 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -14,7 +14,7 @@ on: jobs: build: name: "Python Docker CI Run" - if: contains(github.event.comment.body, '/run-docker-tests') || github.event_name == 'schedule' + if: ${{ (github.event.issue.pull_request && github.event.comment.body == '/run-docker-tests') || github.event_name == 'schedule' }} runs-on: ubuntu-latest strategy: fail-fast: false From 9be092222086f8558822a1f806adee3ba743b717 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 12 Apr 2023 18:44:04 -0500 Subject: [PATCH 22/38] Issue comment test --- .github/workflows/ci_docker_con_workflow.yml | 180 +++++++++---------- .github/workflows/ci_docker_ded_workflow.yml | 180 +++++++++---------- 2 files changed, 180 insertions(+), 180 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index b8cf81140..c3eabb430 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -1,90 +1,90 @@ -# This workflow will run all tests in endtoend/tests in a docker container using the latest consumption image - -name: CI Docker Consumption 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" - issue_comment: - types: [created, edited] - -jobs: - build: - name: "Python Docker CI Run" - if: ${{ (github.event.issue.pull_request && github.event.comment.body == '/run-docker-tests') || github.event_name == 'schedule' }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - env: - CONSUMPTION_DOCKER_TEST: "true" - - steps: - - name: Checkout code. - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install -U -e .[dev] - - name: Running 3.7 Tests - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.8 Tests - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.9 Tests - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.10 Tests - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) +# This workflow will run all tests in endtoend/tests in a docker container using the latest consumption image + +name: CI Docker Consumption 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" + issue_comment: + types: [created, edited] + +jobs: + build: + name: "Python Docker CI Run" + if: (github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run-docker-tests to')) || github.event_name == 'schedule' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + env: + CONSUMPTION_DOCKER_TEST: "true" + + steps: + - name: Checkout code. + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -U -e .[dev] + - name: Running 3.7 Tests + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} + run: | + python -m pytest --instafail tests/endtoend + - name: Running 3.8 Tests + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} + run: | + python -m pytest --instafail tests/endtoend + - name: Running 3.9 Tests + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} + run: | + python -m pytest --instafail tests/endtoend + - name: Running 3.10 Tests + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} + run: | + python -m pytest --instafail tests/endtoend + - name: Codecov + uses: codecov/codecov-action@v1.0.13 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index fb29fec9e..ac39d9f5d 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -1,90 +1,90 @@ -# 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" - issue_comment: - types: [created, edited] - -jobs: - build: - name: "Python Docker CI Run" - if: ${{ (github.event.issue.pull_request && github.event.comment.body == '/run-docker-tests') || github.event_name == 'schedule' }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - env: - DEDICATED_DOCKER_TEST: "true" - - steps: - - name: Checkout code. - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install -U -e .[dev] - - name: Running 3.7 Tests - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.8 Tests - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.9 Tests - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.10 Tests - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) +# 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" + issue_comment: + types: [created, edited] + +jobs: + build: + name: "Python Docker CI Run" + if: (github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run-docker-tests to')) || github.event_name == 'schedule' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + env: + DEDICATED_DOCKER_TEST: "true" + + steps: + - name: Checkout code. + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -U -e .[dev] + - name: Running 3.7 Tests + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} + run: | + python -m pytest --instafail --reruns 4 -vv tests/endtoend + - name: Running 3.8 Tests + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} + run: | + python -m pytest --instafail --reruns 4 -vv tests/endtoend + - name: Running 3.9 Tests + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} + run: | + python -m pytest --instafail --reruns 4 -vv tests/endtoend + - name: Running 3.10 Tests + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} + run: | + python -m pytest --instafail --reruns 4 -vv tests/endtoend + - name: Codecov + uses: codecov/codecov-action@v1.0.13 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) From 37f256757778060580fa346a5e85461217a7258c Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 17 Apr 2023 12:02:46 -0500 Subject: [PATCH 23/38] Reverted workflow changes --- .github/workflows/ci_docker_con_workflow.yml | 177 +++++++++--------- .github/workflows/ci_docker_ded_workflow.yml | 178 +++++++++---------- 2 files changed, 175 insertions(+), 180 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index c3eabb430..8a0dff868 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -1,90 +1,87 @@ -# This workflow will run all tests in endtoend/tests in a docker container using the latest consumption image - -name: CI Docker Consumption 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" - issue_comment: - types: [created, edited] - -jobs: - build: - name: "Python Docker CI Run" - if: (github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run-docker-tests to')) || github.event_name == 'schedule' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - env: - CONSUMPTION_DOCKER_TEST: "true" - - steps: - - name: Checkout code. - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install -U -e .[dev] - - name: Running 3.7 Tests - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.8 Tests - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.9 Tests - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Running 3.10 Tests - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - run: | - python -m pytest --instafail tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) +# This workflow will run all tests in endtoend/tests in a docker container using the latest consumption image + +name: CI Docker Consumption 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" + +jobs: + build: + name: "Python Docker CI Run" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + env: + CONSUMPTION_DOCKER_TEST: "true" + + steps: + - name: Checkout code. + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -U -e .[dev] + - name: Running 3.7 Tests + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + 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 + - name: Running 3.8 Tests + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + 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 + - name: Running 3.9 Tests + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + 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 + - name: Running 3.10 Tests + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + 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/codecov-action@v1.0.13 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index ac39d9f5d..9de65a875 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -1,90 +1,88 @@ -# 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" - issue_comment: - types: [created, edited] - -jobs: - build: - name: "Python Docker CI Run" - if: (github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run-docker-tests to')) || github.event_name == 'schedule' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] - env: - DEDICATED_DOCKER_TEST: "true" - - steps: - - name: Checkout code. - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install -U -e .[dev] - - name: Running 3.7 Tests - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.8 Tests - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.9 Tests - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Running 3.10 Tests - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - run: | - python -m pytest --instafail --reruns 4 -vv tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) +# 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" + +jobs: + build: + name: "Python Docker CI Run" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + env: + DEDICATED_DOCKER_TEST: "true" + + steps: + - name: Checkout code. + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -U -e .[dev] + - name: Running 3.7 Tests + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + 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 + - name: Running 3.8 Tests + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + 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 + - name: Running 3.9 Tests + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + 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 + - name: Running 3.10 Tests + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + 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/codecov-action@v1.0.13 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) From 97dfe7016c4e2ddeb1a2d82352aa831a221cccb7 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 17 Apr 2023 14:02:16 -0500 Subject: [PATCH 24/38] Installing libraries for eventhub batch --- tests/endtoend/test_eventhub_batch_functions.py | 4 ++++ tests/utils/testutils_docker.py | 12 +++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/endtoend/test_eventhub_batch_functions.py b/tests/endtoend/test_eventhub_batch_functions.py index 22456ab22..effb8f7cb 100644 --- a/tests/endtoend/test_eventhub_batch_functions.py +++ b/tests/endtoend/test_eventhub_batch_functions.py @@ -167,6 +167,10 @@ def get_script_dir(cls): return testutils.E2E_TESTS_FOLDER / 'eventhub_batch_functions' / \ 'eventhub_batch_functions_stein' + @classmethod + def get_libraries_to_install(cls): + return ['azure-eventhub'] + def test_eventhub_multiple(self): NUM_EVENTS = 3 all_row_keys_seen = dict([(str(i), True) for i in range(NUM_EVENTS)]) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index e9b777487..19bae4819 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -194,19 +194,13 @@ def create_container(self, image_repo: str, image_url: str, class WebHostConsumption(WebHostDockerContainerBase): - def __init__(self, script_path: str, - libraries_to_install: typing.List = None, - env: typing.Dict = None): - self.script_path = script_path - self.libraries_to_install = libraries_to_install - self.env = env + def __init__(self, configs: DockerConfigs): + self.configs = configs def spawn_container(self): return self.create_container(_MESH_IMAGE_REPO, _MESH_IMAGE_URL, - self.script_path, - self.libraries_to_install, - self.env) + self.configs) class WebHostDedicated(WebHostDockerContainerBase): From 6eb9314312c3df2337379a312b0fb75602bcf7bb Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 17 Apr 2023 14:06:01 -0500 Subject: [PATCH 25/38] Added retries to workflow --- .github/workflows/ci_docker_con_workflow.yml | 8 ++++---- .github/workflows/ci_docker_ded_workflow.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 8a0dff868..7f97b2ca6 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -41,7 +41,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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -53,7 +53,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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -65,7 +65,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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -77,7 +77,7 @@ 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 + python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 9de65a875..2e249ba37 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -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 -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -78,7 +78,7 @@ 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 + python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: From 0170d02866f4f9948b449acff3ce963efc13a121 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 17 Apr 2023 16:12:36 -0500 Subject: [PATCH 26/38] Updated eventhub testscase --- tests/endtoend/test_eventhub_functions.py | 7 ---- tests/utils/testutils.py | 2 +- tests/utils/testutils_docker.py | 44 ++++++++++------------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index a0005423a..f61abb97c 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -53,7 +53,6 @@ def test_eventhub_trigger(self): def test_eventhub_trigger_with_metadata(self): # Generate a unique event body for EventHub event # Record the start_time and end_time for checking event enqueue time - start_time = datetime.now(tz=tz.UTC) random_number = str(round(time.time()) % 1000) req_body = { 'body': random_number @@ -65,7 +64,6 @@ def test_eventhub_trigger_with_metadata(self): data=json.dumps(req_body)) self.assertEqual(r.status_code, 200) self.assertIn('OK', r.text) - end_time = datetime.now(tz=tz.UTC) # Once the event get generated, allow function host to pool from # EventHub and wait for eventhub_trigger to execute, @@ -92,11 +90,6 @@ def test_eventhub_trigger_with_metadata(self): self.assertIsNotNone(event['metadata']) metadata = event['metadata'] sys_props = metadata['SystemProperties'] - enqueued_time = parser.isoparse(metadata['EnqueuedTimeUtc']).astimezone( - tz=tz.UTC) - - self.assertTrue( - start_time.timestamp() < enqueued_time.timestamp() < end_time.timestamp()) # NoQA self.assertIsNone(sys_props['PartitionKey']) self.assertGreaterEqual(sys_props['SequenceNumber'], 0) self.assertIsNotNone(sys_props['Offset']) diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index 1b3762a40..c0b2c8163 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -232,7 +232,7 @@ def setUpClass(cls): docker_configs = DockerConfigs docker_configs.script_path = script_dir docker_configs.libraries = cls.get_libraries_to_install() - docker_configs.env = cls.get_environment_variables() + docker_configs.env = cls.get_environment_variables() or {} if is_envvar_true(PYAZURE_WEBHOST_DEBUG): cls.host_stdout = None diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 19bae4819..8a89cb33d 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -98,6 +98,25 @@ def create_container(self, image_repo: str, image_url: str, worker_path = os.path.join(PROJECT_ROOT, 'azure_functions_worker') script_path = os.path.join(TESTS_ROOT, configs.script_path) + env = {"AzureWebJobsFeatureFlags": "EnableWorkerIndexing", + "AzureWebJobsStorage": f"{os.getenv('AzureWebJobsStorage')}", + "AzureWebJobsEventHubConnectionString": + f"{os.getenv('AzureWebJobsEventHubConnectionString')}", + "AzureWebJobsCosmosDBConnectionString": + f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}", + "AzureWebJobsServiceBusConnectionString": + f"{os.getenv('AzureWebJobsServiceBusConnectionString')}" + "AzureWebJobsEventHubConnectionString" + f"{os.getenv('AzureWebJobsEventHubConnectionString')}", + "AzureWebJobsSqlConnectionString": + f"{os.getenv('AzureWebJobsSqlConnectionString')}", + "AzureWebJobsEventGridTopicUri": + f"{os.getenv('AzureWebJobsEventGridTopicUri')}", + "AzureWebJobsEventGridConnectionKey": + f"{os.getenv('AzureWebJobsEventGridConnectionKey')}" + } + + configs.env.update(env) image = self.find_latest_image(image_repo, image_url) @@ -129,31 +148,6 @@ def create_container(self, image_repo: str, image_url: str, run_cmd.extend(["--cap-add", "SYS_ADMIN"]) run_cmd.extend(["--device", "/dev/fuse"]) run_cmd.extend(["-e", f"CONTAINER_NAME={_uuid}"]) - run_cmd.extend(["-e", "AzureWebJobsFeatureFlags=EnableWorkerIndexing"]) - run_cmd.extend(["-e", - "AzureWebJobsStorage=" - f"{os.getenv('AzureWebJobsStorage')}"]) - run_cmd.extend(["-e", - "AzureWebJobsEventHubConnectionString=" - f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) - run_cmd.extend(["-e", - "AzureWebJobsCosmosDBConnectionString=" - f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}"]) - run_cmd.extend(["-e", - "AzureWebJobsServiceBusConnectionString=" - f"{os.getenv('AzureWebJobsServiceBusConnectionString')}"]) # NoQA - run_cmd.extend(["-e", - "AzureWebJobsEventHubConnectionString=" - f"{os.getenv('AzureWebJobsEventHubConnectionString')}"]) - run_cmd.extend(["-e", - "AzureWebJobsSqlConnectionString=" - f"{os.getenv('AzureWebJobsSqlConnectionString')}"]) - run_cmd.extend(["-e", - "AzureWebJobsEventGridTopicUri=" - f"{os.getenv('AzureWebJobsEventGridTopicUri')}"]) - run_cmd.extend(["-e", - "AzureWebJobsEventGridConnectionKey=" - f"{os.getenv('AzureWebJobsEventGridConnectionKey')}"]) run_cmd.extend(["-e", f"AzureFunctionsWebHost__hostid={_uuid}"]) run_cmd.extend(["-v", f"{worker_path}:{container_worker_path}"]) run_cmd.extend(["-v", f"{script_path}:{function_path}"]) From 52da63683078220e27f86eb4b1b2e3fbdd015aca Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 18 Apr 2023 10:51:16 -0500 Subject: [PATCH 27/38] Fixing env variables --- tests/utils/testutils_docker.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 8a89cb33d..1817137d1 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -105,9 +105,7 @@ def create_container(self, image_repo: str, image_url: str, "AzureWebJobsCosmosDBConnectionString": f"{os.getenv('AzureWebJobsCosmosDBConnectionString')}", "AzureWebJobsServiceBusConnectionString": - f"{os.getenv('AzureWebJobsServiceBusConnectionString')}" - "AzureWebJobsEventHubConnectionString" - f"{os.getenv('AzureWebJobsEventHubConnectionString')}", + f"{os.getenv('AzureWebJobsServiceBusConnectionString')}", "AzureWebJobsSqlConnectionString": f"{os.getenv('AzureWebJobsSqlConnectionString')}", "AzureWebJobsEventGridTopicUri": From 5dc59e638c021e252344ed8514a897ff84063392 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Tue, 18 Apr 2023 12:00:44 -0500 Subject: [PATCH 28/38] Removing xdist --- .github/workflows/ci_consumption_workflow.yml | 8 ++++---- .github/workflows/ci_docker_con_workflow.yml | 8 ++++---- .github/workflows/ci_docker_ded_workflow.yml | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_consumption_workflow.yml b/.github/workflows/ci_consumption_workflow.yml index 0db28c59b..120a2db49 100644 --- a/.github/workflows/ci_consumption_workflow.yml +++ b/.github/workflows/ci_consumption_workflow.yml @@ -33,19 +33,19 @@ jobs: if: matrix.python-version == 3.7 env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - run: python -m pytest -n auto --reruns 4 --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 --reruns 4 --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 --reruns 4 --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 --reruns 4 --instafail tests/consumption_tests + run: python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index 7f97b2ca6..c4f109441 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -41,7 +41,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -53,7 +53,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -65,7 +65,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -77,7 +77,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 2e249ba37..533266a8c 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -42,7 +42,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.8 Tests if: matrix.python-version == 3.8 env: @@ -54,7 +54,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.9 Tests if: matrix.python-version == 3.9 env: @@ -66,7 +66,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Running 3.10 Tests if: matrix.python-version == 3.10 env: @@ -78,7 +78,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} run: | - python -m pytest -n auto --dist loadfile --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend + python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - name: Codecov uses: codecov/codecov-action@v1.0.13 with: From c6faaba80732b71da9227a97481c99ba4f4d1f6d Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 19 Apr 2023 12:15:57 -0500 Subject: [PATCH 29/38] Fixed eventhub tests --- .github/workflows/ci_docker_con_workflow.yml | 4 ++-- .github/workflows/ci_docker_ded_workflow.yml | 2 +- tests/endtoend/test_eventhub_batch_functions.py | 15 +++++++++++++++ tests/endtoend/test_eventhub_functions.py | 12 ++++++++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index c4f109441..aa87c9637 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -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: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 533266a8c..abaee41f5 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -8,7 +8,7 @@ on: 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: diff --git a/tests/endtoend/test_eventhub_batch_functions.py b/tests/endtoend/test_eventhub_batch_functions.py index effb8f7cb..73c1840ec 100644 --- a/tests/endtoend/test_eventhub_batch_functions.py +++ b/tests/endtoend/test_eventhub_batch_functions.py @@ -4,11 +4,20 @@ import time import pathlib from datetime import datetime +from unittest import skipIf + from dateutil import parser, tz +from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils +from tests.utils.constants import DEDICATED_DOCKER_TEST, CONSUMPTION_DOCKER_TEST +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Table functions which are used in the bindings in these tests" + " has a bug with the table extension 1.0.0. " + "https://github.com/Azure/azure-sdk-for-net/issues/33902.") class TestEventHubFunctions(testutils.WebHostTestCase): """Test EventHub Trigger and Output Bindings (cardinality: many). @@ -57,6 +66,7 @@ def test_eventhub_multiple(self): try: r = self.webhost.request('GET', 'get_eventhub_batch_triggered') + time.sleep(2) self.assertEqual(r.status_code, 200) entries = r.json() for entry in entries: @@ -160,6 +170,11 @@ def _get_table_function_json_path(self): return testutils.TESTS_ROOT / script_dir / json_path +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "Table functions which are used in the bindings has a bug with the" + " table extension 1.0.0. " + "https://github.com/Azure/azure-sdk-for-net/issues/33902.") class TestEventHubBatchFunctionsStein(testutils.WebHostTestCase): @classmethod diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index f61abb97c..5c3265cbf 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -40,10 +40,14 @@ def test_eventhub_trigger(self): # Once the event get generated, allow function host to poll from # EventHub and wait for eventhub_trigger to execute, # converting the event metadata into a blob. - time.sleep(5) + time.sleep(3) # Call get_eventhub_triggered to retrieve event metadata from blob. r = self.webhost.request('GET', 'get_eventhub_triggered') + + # Sleeping to let the blob get updated with the latest data from the + # eventhub output binding + time.sleep(2) self.assertEqual(r.status_code, 200) response = r.json() @@ -68,10 +72,14 @@ def test_eventhub_trigger_with_metadata(self): # Once the event get generated, allow function host to pool from # EventHub and wait for eventhub_trigger to execute, # converting the event metadata into a blob. - time.sleep(5) + time.sleep(3) # Call get_metadata_triggered to retrieve event metadata from blob r = self.webhost.request('GET', 'get_metadata_triggered') + + # Sleeping to let the blob get updated with the latest data from the + # eventhub output binding + time.sleep(2) self.assertEqual(r.status_code, 200) # Check if the event body matches the unique random_number From b108e1ee3edc26d1baedcc38b0a88df6eec0af6d Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 19 Apr 2023 13:14:34 -0500 Subject: [PATCH 30/38] Fixing eventhub with longer wait and retries --- .github/workflows/ci_docker_con_workflow.yml | 15 ++++----------- .github/workflows/ci_docker_ded_workflow.yml | 15 ++++----------- tests/endtoend/test_blob_functions.py | 3 ++- tests/endtoend/test_eventhub_functions.py | 10 ++++++---- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index aa87c9637..c499abec4 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -41,7 +41,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -53,7 +53,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -65,7 +65,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -77,11 +77,4 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} run: | - python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - 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 diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index abaee41f5..8a8f2a5c3 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -42,7 +42,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -54,7 +54,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -66,7 +66,7 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} run: | - python -m pytest --reruns 4 -vv --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: @@ -78,11 +78,4 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} run: | - python -m pytest --reruns 4 -vv --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - 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 diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index d55ebeb8b..0f7003ac1 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import time +from json import JSONDecodeError from tests.utils import testutils @@ -141,7 +142,7 @@ def test_blob_trigger_with_large_content(self): self.assertEqual(response['content'], data) break - except AssertionError: + except AssertionError or JSONDecodeError: if try_no == max_retries - 1: raise diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index 5c3265cbf..7f8672656 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -26,6 +26,7 @@ def get_script_dir(cls): def get_libraries_to_install(cls): return ['azure-eventhub'] + @testutils.retryable_test(3, 5) def test_eventhub_trigger(self): # Generate a unique event body for the EventHub event data = str(round(time.time())) @@ -40,20 +41,21 @@ def test_eventhub_trigger(self): # Once the event get generated, allow function host to poll from # EventHub and wait for eventhub_trigger to execute, # converting the event metadata into a blob. - time.sleep(3) + time.sleep(5) # Call get_eventhub_triggered to retrieve event metadata from blob. r = self.webhost.request('GET', 'get_eventhub_triggered') # Sleeping to let the blob get updated with the latest data from the # eventhub output binding - time.sleep(2) + time.sleep(5) self.assertEqual(r.status_code, 200) response = r.json() # Check if the event body matches the initial data self.assertEqual(response, doc) + @testutils.retryable_test(3, 5) def test_eventhub_trigger_with_metadata(self): # Generate a unique event body for EventHub event # Record the start_time and end_time for checking event enqueue time @@ -72,14 +74,14 @@ def test_eventhub_trigger_with_metadata(self): # Once the event get generated, allow function host to pool from # EventHub and wait for eventhub_trigger to execute, # converting the event metadata into a blob. - time.sleep(3) + time.sleep(5) # Call get_metadata_triggered to retrieve event metadata from blob r = self.webhost.request('GET', 'get_metadata_triggered') # Sleeping to let the blob get updated with the latest data from the # eventhub output binding - time.sleep(2) + time.sleep(5) self.assertEqual(r.status_code, 200) # Check if the event body matches the unique random_number From b4f0a645528fcfe7f64cf87be5871351ef029ea5 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 19 Apr 2023 15:39:17 -0500 Subject: [PATCH 31/38] Addressed comments --- tests/endtoend/test_blob_functions.py | 2 ++ tests/endtoend/test_dependency_isolation_functions.py | 1 - tests/endtoend/test_durable_functions.py | 11 +---------- tests/endtoend/test_eventhub_functions.py | 3 --- .../endtoend/test_worker_proccess_count_functions.py | 2 -- tests/utils/testutils.py | 1 + 6 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index 0f7003ac1..d2d2a3dff 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -132,6 +132,8 @@ def test_blob_trigger_with_large_content(self): try: # Check that the trigger has fired r = self.webhost.request('GET', 'get_blob_triggered') + + # Waiting for blob to get updated time.sleep(2) self.assertEqual(r.status_code, 200) diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index f01d30a17..79074dd96 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -30,7 +30,6 @@ class TestGRPCandProtobufDependencyIsolationOnDedicated( package_name = '.python_packages_grpc_protobuf' project_root = testutils.E2E_TESTS_ROOT / function_name customer_deps = project_root / package_name / 'lib' / 'site-packages' - env_variables = {} @classmethod def setUpClass(cls): diff --git a/tests/endtoend/test_durable_functions.py b/tests/endtoend/test_durable_functions.py index cf0538142..d65adde14 100644 --- a/tests/endtoend/test_durable_functions.py +++ b/tests/endtoend/test_durable_functions.py @@ -1,24 +1,15 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from unittest import skipIf -from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils -from tests.utils.constants import DEDICATED_DOCKER_TEST, \ - CONSUMPTION_DOCKER_TEST -@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) - or is_envvar_true(CONSUMPTION_DOCKER_TEST), - "Docker container cannot set webhook required " - "for durable tests") class TestDurableFunctions(testutils.WebHostTestCase): - env_variables = {} @classmethod def setUpClass(cls): # webhook for durable tests - cls.env_variables['WEBSITE_HOSTNAME'] = "http://*:8080" + cls.env_variables['WEBSITE_HOSTNAME'] = "http:" super().setUpClass() @classmethod diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index 7f8672656..5b4372e35 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -2,9 +2,6 @@ # Licensed under the MIT License. import json import time -from datetime import datetime - -from dateutil import parser, tz from tests.utils import testutils diff --git a/tests/endtoend/test_worker_proccess_count_functions.py b/tests/endtoend/test_worker_proccess_count_functions.py index f8a82fe67..519d8982e 100644 --- a/tests/endtoend/test_worker_proccess_count_functions.py +++ b/tests/endtoend/test_worker_proccess_count_functions.py @@ -13,8 +13,6 @@ class TestWorkerProcessCount(testutils.WebHostTestCase): same time. this file is more focused on testing the E2E flow scenario for FUNCTIONS_WORKER_PROCESS_COUNT feature. """ - env_variables = {} - @classmethod def setUpClass(cls): cls.env_variables['PYTHON_THREADPOOL_THREAD_COUNT'] = '1' diff --git a/tests/utils/testutils.py b/tests/utils/testutils.py index c0b2c8163..7afd17eed 100644 --- a/tests/utils/testutils.py +++ b/tests/utils/testutils.py @@ -212,6 +212,7 @@ class WebHostTestCase(unittest.TestCase, metaclass=WebHostTestCaseMeta): check_log_ABC - Check logs generated during the execution of test_ABC. """ host_stdout_logger = logging.getLogger('webhosttests') + env_variables = {} @classmethod def get_script_dir(cls): From 1b7a5b9a66e937fec8ff3ac0ebc2b3757b1ef044 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 19 Apr 2023 16:29:53 -0500 Subject: [PATCH 32/38] Skipping durable tests --- tests/endtoend/test_blob_functions.py | 3 ++- tests/endtoend/test_durable_functions.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index d2d2a3dff..45584ca91 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -1,7 +1,8 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import time -from json import JSONDecodeError + +from requests import JSONDecodeError from tests.utils import testutils diff --git a/tests/endtoend/test_durable_functions.py b/tests/endtoend/test_durable_functions.py index d65adde14..6711f7d9d 100644 --- a/tests/endtoend/test_durable_functions.py +++ b/tests/endtoend/test_durable_functions.py @@ -1,9 +1,16 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from unittest import skipIf +from azure_functions_worker.utils.common import is_envvar_true from tests.utils import testutils +from tests.utils.constants import DEDICATED_DOCKER_TEST, CONSUMPTION_DOCKER_TEST +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + "This will be fixed in " + "https://github.com/Azure/azure-functions-python-worker/pull/1199") class TestDurableFunctions(testutils.WebHostTestCase): @classmethod From 3fa6b1fe316c946707c11d36280742443dfd163e Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 19 Apr 2023 17:36:45 -0500 Subject: [PATCH 33/38] Added custom image env --- .github/workflows/ci_docker_ded_workflow.yml | 1 - tests/utils/testutils_docker.py | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 8a8f2a5c3..7a815aae3 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -1,6 +1,5 @@ # This workflow will run all tests in endtoend/tests in a docker container using the latest dedicated image - name: CI Docker Dedicated tests on: diff --git a/tests/utils/testutils_docker.py b/tests/utils/testutils_docker.py index 1817137d1..830a9b1cb 100644 --- a/tests/utils/testutils_docker.py +++ b/tests/utils/testutils_docker.py @@ -24,6 +24,7 @@ _MESH_IMAGE_REPO = "mcr.microsoft.com/azure-functions/mesh" _IMAGE_URL = "https://mcr.microsoft.com/v2/azure-functions/python/tags/list" _IMAGE_REPO = "mcr.microsoft.com/azure-functions/python" +_CUSTOM_IMAGE = os.getenv("IMAGE_NAME") @dataclass @@ -116,7 +117,10 @@ def create_container(self, image_repo: str, image_url: str, configs.env.update(env) - image = self.find_latest_image(image_repo, image_url) + if _CUSTOM_IMAGE: + image = _CUSTOM_IMAGE + else: + image = self.find_latest_image(image_repo, image_url) container_worker_path = ( f"/azure-functions-host/workers/python/{_python_version}/" From f2831994713d88c7cf4bbfe159e28b684f6aaa75 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 20 Apr 2023 08:43:41 -0500 Subject: [PATCH 34/38] Removing env variables --- tests/endtoend/test_threadpool_thread__count_functions.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/endtoend/test_threadpool_thread__count_functions.py b/tests/endtoend/test_threadpool_thread__count_functions.py index ada5c10b4..1f9aae91b 100644 --- a/tests/endtoend/test_threadpool_thread__count_functions.py +++ b/tests/endtoend/test_threadpool_thread__count_functions.py @@ -14,8 +14,6 @@ class TestPythonThreadpoolThreadCount(testutils.WebHostTestCase): scenarios. """ - env_variables = {} - @classmethod def setUpClass(cls): cls.env_variables['PYTHON_THREADPOOL_THREAD_COUNT'] = '2' From 4e8530f2b7e7ce2e1302627978b7c16aeb75623a Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Thu, 20 Apr 2023 09:26:22 -0500 Subject: [PATCH 35/38] Running setup build --- .github/workflows/ci_docker_con_workflow.yml | 1 + .github/workflows/ci_docker_ded_workflow.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci_docker_con_workflow.yml b/.github/workflows/ci_docker_con_workflow.yml index c499abec4..e5b7b4613 100644 --- a/.github/workflows/ci_docker_con_workflow.yml +++ b/.github/workflows/ci_docker_con_workflow.yml @@ -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: diff --git a/.github/workflows/ci_docker_ded_workflow.yml b/.github/workflows/ci_docker_ded_workflow.yml index 7a815aae3..1bfc1fd8a 100644 --- a/.github/workflows/ci_docker_ded_workflow.yml +++ b/.github/workflows/ci_docker_ded_workflow.yml @@ -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: From 5fe55b977181ae7768a4441e4829a5079f0844c4 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Fri, 21 Apr 2023 09:52:58 -0500 Subject: [PATCH 36/38] Updated comments --- tests/endtoend/test_blob_functions.py | 2 +- tests/endtoend/test_durable_functions.py | 2 +- tests/endtoend/test_eventhub_batch_functions.py | 3 +++ tests/endtoend/test_eventhub_functions.py | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/endtoend/test_blob_functions.py b/tests/endtoend/test_blob_functions.py index 45584ca91..87e56c9bd 100644 --- a/tests/endtoend/test_blob_functions.py +++ b/tests/endtoend/test_blob_functions.py @@ -143,8 +143,8 @@ def test_blob_trigger_with_large_content(self): self.assertEqual(response['name'], 'python-worker-tests/test-blob-trigger.txt') self.assertEqual(response['content'], data) - break + # JSONDecodeError will be thrown if the response is empty. except AssertionError or JSONDecodeError: if try_no == max_retries - 1: raise diff --git a/tests/endtoend/test_durable_functions.py b/tests/endtoend/test_durable_functions.py index 6711f7d9d..2027e83ca 100644 --- a/tests/endtoend/test_durable_functions.py +++ b/tests/endtoend/test_durable_functions.py @@ -9,7 +9,7 @@ @skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) or is_envvar_true(CONSUMPTION_DOCKER_TEST), - "This will be fixed in " + "TODO: This will be fixed in " "https://github.com/Azure/azure-functions-python-worker/pull/1199") class TestDurableFunctions(testutils.WebHostTestCase): diff --git a/tests/endtoend/test_eventhub_batch_functions.py b/tests/endtoend/test_eventhub_batch_functions.py index 73c1840ec..da12824e2 100644 --- a/tests/endtoend/test_eventhub_batch_functions.py +++ b/tests/endtoend/test_eventhub_batch_functions.py @@ -66,6 +66,9 @@ def test_eventhub_multiple(self): try: r = self.webhost.request('GET', 'get_eventhub_batch_triggered') + + # Waiting for the blob get updated with the latest data from the + # eventhub output binding time.sleep(2) self.assertEqual(r.status_code, 200) entries = r.json() diff --git a/tests/endtoend/test_eventhub_functions.py b/tests/endtoend/test_eventhub_functions.py index 5b4372e35..c4c3d74ab 100644 --- a/tests/endtoend/test_eventhub_functions.py +++ b/tests/endtoend/test_eventhub_functions.py @@ -43,7 +43,7 @@ def test_eventhub_trigger(self): # Call get_eventhub_triggered to retrieve event metadata from blob. r = self.webhost.request('GET', 'get_eventhub_triggered') - # Sleeping to let the blob get updated with the latest data from the + # Waiting for the blob get updated with the latest data from the # eventhub output binding time.sleep(5) self.assertEqual(r.status_code, 200) @@ -76,7 +76,7 @@ def test_eventhub_trigger_with_metadata(self): # Call get_metadata_triggered to retrieve event metadata from blob r = self.webhost.request('GET', 'get_metadata_triggered') - # Sleeping to let the blob get updated with the latest data from the + # Waiting for the blob get updated with the latest data from the # eventhub output binding time.sleep(5) self.assertEqual(r.status_code, 200) From f5d41ec8f3150a6e457e365ab253a6361fc4249c Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 26 Apr 2023 20:39:47 -0500 Subject: [PATCH 37/38] Minor fixes and refactoring --- .../function_app.py | 47 ++++++++++++++ .../generic/function_app.py | 62 +++++++++++++++++++ .../test_dependency_isolation_functions.py | 14 ++--- ...test_threadpool_thread_count_functions.py} | 0 ...=> test_worker_process_count_functions.py} | 0 5 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/function_app.py create mode 100644 tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/generic/function_app.py rename tests/endtoend/{test_threadpool_thread__count_functions.py => test_threadpool_thread_count_functions.py} (100%) rename tests/endtoend/{test_worker_proccess_count_functions.py => test_worker_process_count_functions.py} (100%) diff --git a/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/function_app.py b/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/function_app.py new file mode 100644 index 000000000..27f51e38a --- /dev/null +++ b/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/function_app.py @@ -0,0 +1,47 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import azure.functions as func + +app = func.FunctionApp() + + +@app.route() +@app.cosmos_db_input_v3( + arg_name="docs", database_name="test", + collection_name="items", + id="cosmosdb-input-test", + connection_string_setting="AzureWebJobsCosmosDBConnectionString") +def cosmosdb_input(req: func.HttpRequest, docs: func.DocumentList) -> str: + return func.HttpResponse(docs[0].to_json(), mimetype='application/json') + + +@app.cosmos_db_trigger_v3( + arg_name="docs", database_name="test", + collection_name="items", + lease_collection_name="leases", + connection_string_setting="AzureWebJobsCosmosDBConnectionString", + create_lease_collection_if_not_exists=True) +@app.blob_output(arg_name="$return", connection="AzureWebJobsStorage", + path="python-worker-tests/test-cosmosdb-triggered.txt") +def cosmosdb_trigger(docs: func.DocumentList) -> str: + return docs[0].to_json() + + +@app.route() +@app.blob_input(arg_name="file", connection="AzureWebJobsStorage", + path="python-worker-tests/test-cosmosdb-triggered.txt") +def get_cosmosdb_triggered(req: func.HttpRequest, + file: func.InputStream) -> str: + return file.read().decode('utf-8') + + +@app.route() +@app.cosmos_db_output_v3( + arg_name="doc", database_name="test", + collection_name="items", + create_if_not_exists=True, + connection_string_setting="AzureWebJobsCosmosDBConnectionString") +def put_document(req: func.HttpRequest, doc: func.Out[func.Document]): + doc.set(func.Document.from_json(req.get_body())) + + return 'OK' diff --git a/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/generic/function_app.py b/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/generic/function_app.py new file mode 100644 index 000000000..dee78952a --- /dev/null +++ b/tests/endtoend/cosmosdb_functions/cosmosdb_v3_functions_stein/generic/function_app.py @@ -0,0 +1,62 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import azure.functions as func + +app = func.FunctionApp() + + +@app.generic_trigger(arg_name="req", type="httpTrigger") +@app.generic_output_binding(arg_name="$return", type="http") +@app.generic_input_binding( + arg_name="docs", + type="cosmosDB", + database_name="test", + collection_name="items", + id="cosmosdb-input-test", + connection_string_setting="AzureWebJobsCosmosDBConnectionString") +def cosmosdb_input(req: func.HttpRequest, docs: func.DocumentList) -> str: + return func.HttpResponse(docs[0].to_json(), mimetype='application/json') + + +@app.generic_trigger( + arg_name="docs", + type="cosmosDBTrigger", + database_name="test", + collection_name="items", + lease_collection_name="leases", + connection_string_setting="AzureWebJobsCosmosDBConnectionString", + create_lease_collection_if_not_exists=True) +@app.generic_output_binding( + arg_name="$return", + type="blob", + connection="AzureWebJobsStorage", + path="python-worker-tests/test-cosmosdb-triggered.txt") +def cosmosdb_trigger(docs: func.DocumentList) -> str: + return docs[0].to_json() + + +@app.generic_trigger(arg_name="req", type="httpTrigger") +@app.generic_output_binding(arg_name="$return", type="http") +@app.generic_input_binding( + arg_name="file", + connection="AzureWebJobsStorage", + type="blob", + path="python-worker-tests/test-cosmosdb-triggered.txt") +def get_cosmosdb_triggered(req: func.HttpRequest, + file: func.InputStream) -> str: + return file.read().decode('utf-8') + + +@app.generic_trigger(arg_name="req", type="httpTrigger") +@app.generic_output_binding(arg_name="$return", type="http") +@app.generic_output_binding( + arg_name="doc", + database_name="test", + type="cosmosDB", + collection_name="items", + create_if_not_exists=True, + connection_string_setting="AzureWebJobsCosmosDBConnectionString") +def put_document(req: func.HttpRequest, doc: func.Out[func.Document]): + doc.set(func.Document.from_json(req.get_body())) + + return 'OK' diff --git a/tests/endtoend/test_dependency_isolation_functions.py b/tests/endtoend/test_dependency_isolation_functions.py index 79074dd96..c2f5cedb8 100644 --- a/tests/endtoend/test_dependency_isolation_functions.py +++ b/tests/endtoend/test_dependency_isolation_functions.py @@ -16,6 +16,9 @@ REQUEST_TIMEOUT_SEC = 5 +@skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) + or is_envvar_true(CONSUMPTION_DOCKER_TEST), + 'Docker tests do not work with dependency isolation ') class TestGRPCandProtobufDependencyIsolationOnDedicated( testutils.WebHostTestCase): """Test the dependency manager E2E scenario via Http Trigger. @@ -76,10 +79,6 @@ def test_feature_flag_is_turned_on(self): flag_value = environments['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] self.assertEqual(flag_value, '1') - @skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) - or is_envvar_true(CONSUMPTION_DOCKER_TEST), - "Docker test expects dependencies derived from agents folder" - ) def test_working_directory_resolution(self): """Check from the dependency manager and see if the current working directory is resolved correctly @@ -93,9 +92,7 @@ def test_working_directory_resolution(self): os.path.join(dir, 'dependency_isolation_functions').lower() ) - @skipIf(is_envvar_true(PYAZURE_INTEGRATION_TEST) - or is_envvar_true(DEDICATED_DOCKER_TEST) - or is_envvar_true(CONSUMPTION_DOCKER_TEST), + @skipIf(is_envvar_true(PYAZURE_INTEGRATION_TEST), 'Integration test expects dependencies derived from core ' 'tools folder') def test_paths_resolution(self): @@ -121,9 +118,6 @@ def test_paths_resolution(self): ).lower() ) - @skipIf(is_envvar_true(DEDICATED_DOCKER_TEST) - or is_envvar_true(CONSUMPTION_DOCKER_TEST), - 'Docker tests do not work with dependency isolation ') def test_loading_libraries_from_customers_package(self): """Since the Python now loaded the customer's dependencies, the libraries version should match the ones in diff --git a/tests/endtoend/test_threadpool_thread__count_functions.py b/tests/endtoend/test_threadpool_thread_count_functions.py similarity index 100% rename from tests/endtoend/test_threadpool_thread__count_functions.py rename to tests/endtoend/test_threadpool_thread_count_functions.py diff --git a/tests/endtoend/test_worker_proccess_count_functions.py b/tests/endtoend/test_worker_process_count_functions.py similarity index 100% rename from tests/endtoend/test_worker_proccess_count_functions.py rename to tests/endtoend/test_worker_process_count_functions.py From 253934265453c751efc867b4e09e68b8c6780987 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Wed, 26 Apr 2023 20:57:21 -0500 Subject: [PATCH 38/38] Addind setup build to consumption tests --- .github/workflows/ci_consumption_workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_consumption_workflow.yml b/.github/workflows/ci_consumption_workflow.yml index 120a2db49..a7c2efd50 100644 --- a/.github/workflows/ci_consumption_workflow.yml +++ b/.github/workflows/ci_consumption_workflow.yml @@ -29,6 +29,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: