diff --git a/.github/workflows/aws-lambda-flake-check.yml b/.github/workflows/aws-lambda-flake-check.yml new file mode 100644 index 0000000000..f1fff7a75a --- /dev/null +++ b/.github/workflows/aws-lambda-flake-check.yml @@ -0,0 +1,41 @@ +name: AWS Lambda Flake Check + +on: + pull_request: + push: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + aws-lambda-flake: + name: aws_lambda py${{ matrix.python-version }} #${{ matrix.attempt }} + timeout-minutes: 30 + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.11", "3.13"] + attempt: [1, 2, 3, 4, 5] + services: + docker: + image: docker:dind + options: --privileged + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Install uv + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + enable-cache: false + - name: Setup Test Env + run: uv sync + - name: Test aws_lambda (attempt ${{ matrix.attempt }}) + run: | + set -x + ./scripts/runtox.sh "py${{ matrix.python-version }}-aws_lambda" diff --git a/tests/integrations/aws_lambda/test_aws_lambda.py b/tests/integrations/aws_lambda/test_aws_lambda.py index 01ca19bd54..c9ecfc06e4 100644 --- a/tests/integrations/aws_lambda/test_aws_lambda.py +++ b/tests/integrations/aws_lambda/test_aws_lambda.py @@ -14,6 +14,7 @@ DOCKER_NETWORK_NAME = "lambda-test-network" SAM_TEMPLATE_FILE = "sam.template.yaml" +SAM_SHUTDOWN_TIMEOUT = 60 @pytest.fixture(scope="session", autouse=True) @@ -78,13 +79,12 @@ def before_test(): finally: print("[test_environment fixture] Tearing down AWS Lambda test infrastructure") - process.terminate() - process.wait(timeout=10) # Give it time to shut down gracefully - - # Force kill if still running - if process.poll() is None: + try: + process.wait(timeout=SAM_SHUTDOWN_TIMEOUT) + except subprocess.TimeoutExpired: process.kill() + process.wait() @pytest.fixture(autouse=True)