Skip to content

Conversation

@Hazhzeng
Copy link
Contributor

@Hazhzeng Hazhzeng commented Aug 4, 2021

Description

This new testutils_lc.py allows end-to-end testing scenario to run through the Linux Consumption Container => Placeholder Mode => Specialization => Function Load => Function Invocation.

It ensures any gaps between linux consumption specialization is well covered.

The example apps are not lying in the repository, it is in the following blob storage (read-only):
https://pythonworker36sa.blob.core.windows.net/python-worker-lc-apps?restype=container&comp=list
https://pythonworker37sa.blob.core.windows.net/python-worker-lc-apps?restype=container&comp=list
https://pythonworker38sa.blob.core.windows.net/python-worker-lc-apps?restype=container&comp=list
https://pythonworker39sa.blob.core.windows.net/python-worker-lc-apps?restype=container&comp=list

When failure occurs, it also prints out the error messages from the containers for fast diagnoses.

To add more scenarios:

  1. Create a function app locally
  2. Use func azure functionapp publish python-worker-<python_version>-lc-func to remote build the artifact (e.g. python-worker-37-lc-func)
  3. Download the artifact from https://python-worker-<python_version>-lc-func.scm.azurewebsites.net/api/settings => SCM_RUN_FROM_PACKAGE.
  4. Upload the package onto Simple Batch Subscription => AzureFunctionsPythonWorkerCILinuxDevOps Resource Group => pythonworker<python_major><python_minor>sa Storage Account => python-worker-lc-apps Blob Container
  5. Follow the example in endtoend/test_linux_consumption.py to create a new test case.
    /cc: @AnatoliB @vrdmr @stefanushinardi

PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and CI is passing.

Quality of Code and Contribution Guidelines

@Hazhzeng Hazhzeng requested a review from vrdmr August 4, 2021 01:04
@Hazhzeng
Copy link
Contributor Author

Hazhzeng commented Aug 4, 2021

This test works fine on local machine.
But GitHub Action host agent is not able to find docker or /usr/bin/docker in the python (pytest) process.

FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/docker run -p 0:80 -d --name adc7230d-fc37-4278-8026-13a479deb455 --cap-add SYS_ADMIN --device /dev/fuse -e "CONTAINER_NAME"="adc7230d-fc37-4278-8026-13a479deb455" -e "CONTAINER_ENCRYPTION_KEY"="MDEyMzQ1Njc4OUFCQ0RFRjAxMjM0NTY3ODlBQkNERUY=" -e "WEBSITE_PLACEHOLDER_MODE"="1" -v "/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker":"/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker" mcr.microsoft.com/azure-functions/mesh:3.1.4-upgrade': '/usr/bin/docker run -p 0:80 -d --name adc7230d-fc37-4278-8026-13a479deb455 --cap-add SYS_ADMIN --device /dev/fuse -e "CONTAINER_NAME"="adc7230d-fc37-4278-8026-13a479deb455" -e "CONTAINER_ENCRYPTION_KEY"="MDEyMzQ1Njc4OUFCQ0RFRjAxMjM0NTY3ODlBQkNERUY=" -e "WEBSITE_PLACEHOLDER_MODE"="1" -v "/home/runner/work/azure-functions-python-worker/azure-functions-python-worker/azure_functions_worker":"/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker" mcr.microsoft.com/azure-functions/mesh:3.1.4-upgrade'

@Hazhzeng
Copy link
Contributor Author

Hazhzeng commented Aug 4, 2021

Able to run docker with command, but failed to mount in mesh container.
MS_FUNCTION_LOGS 2,,mesh-placeholder,mesh-placeholder,mesh.init,Host.Startup,"","Request for / failed with err exit status 1 error: fuse: mount failed: Permission denied output: ",3.1.4.0,2021-08-04T23:04:14.140267986Z,,"",,,,77969af3-87bc-4904-af12-838e2888bb78,,

Hanzhang Zeng (Roger) added 2 commits August 4, 2021 16:15
@Hazhzeng
Copy link
Contributor Author

Hazhzeng commented Aug 4, 2021

Running the docker container with --priviledged flag resolves all the issues. This PR is ready for review now.


return f'http://localhost:{self._ports[self._uuid]}'

def assign_container(self, env: Dict[str, str] = {}):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. How long do we wait after the container starts before sending the /assign request?

Copy link
Contributor Author

@Hazhzeng Hazhzeng Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It waits for 3 seconds in the spawn_container method. I want to ensure the container is already in ready state when calling

with Linux ConsumptionWebHostController() as container:
    # container is ready here
    container.assign_container({})

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great. that should be good enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can call an API in the container to check if it is active and responding? Such that we don't have to add an artificial wait?

Copy link
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review in progress - will complete by tomorrow.


return f'http://localhost:{self._ports[self._uuid]}'

def assign_container(self, env: Dict[str, str] = {}):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can call an API in the container to check if it is active and responding? Such that we don't have to add an artificial wait?

@Hazhzeng Hazhzeng requested a review from vrdmr August 11, 2021 18:30
@vrdmr vrdmr merged commit 7630661 into dev Sep 18, 2021
@vrdmr vrdmr deleted the hazeng/new-e2e branch September 18, 2021 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants