diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 280539f094..04c23b8d79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,12 +27,14 @@ jobs: - make-pr - integration-tests - smoke-and-functional-tests + - docker-disabled steps: - name: report-failure if : | needs.make-pr.result != 'success' || needs.integration-tests.result != 'success' || - needs.smoke-and-functional-tests.result != 'success' + needs.smoke-and-functional-tests.result != 'success' || + needs.docker-disabled.result != 'success' run: exit 1 - name: report-success run: exit 0 @@ -187,3 +189,43 @@ jobs: run: make init - name: Run functional & smoke tests run: pytest -vv -n 4 tests/functional tests/smoke + + docker-disabled: + name: Docker-disabled Tests / ${{ matrix.os }} + if: github.repository_owner == 'aws' + runs-on: ${{ matrix.os }} + env: + SAM_CLI_DEV: "1" + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + # These are the versions of Python that correspond to the supported Lambda runtimes + python-version: | + 3.10 + 3.9 + 3.8 + 3.7 + - name: Init samdev + run: make init + - name: Stop Docker Linux + if: ${{ matrix.os == 'ubuntu-latest' }} + run: sudo systemctl stop docker + - name: Stop Docker Windows + if: ${{ matrix.os == 'windows-latest' }} + shell: pwsh + run: stop-service docker + - name: Check Docker not Running + run: docker info + id: run-docker-info + continue-on-error: true + - name: Report failure + if: steps.run-docker-info.outcome == 'success' + run: exit 1 + - name: Run tests without Docker + run: pytest -vv tests/integration/buildcmd/test_build_cmd.py -k TestBuildCommand_PythonFunctions_WithoutDocker diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py index f23b4f4f10..394964c4af 100644 --- a/tests/integration/buildcmd/test_build_cmd.py +++ b/tests/integration/buildcmd/test_build_cmd.py @@ -398,34 +398,64 @@ def _validate_skipped_built_function( "overrides", "runtime", "codeuri", - "use_container", "check_function_only", "prop", ), [ - ("template.yaml", "Function", True, "python3.7", "Python", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.8", "Python", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.9", "Python", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.10", "Python", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.7", "PythonPEP600", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.8", "PythonPEP600", False, False, "CodeUri"), - ("template.yaml", "Function", True, "python3.7", "Python", "use_container", False, "CodeUri"), - ("template.yaml", "Function", True, "python3.8", "Python", "use_container", False, "CodeUri"), - ("template.yaml", "Function", True, "python3.9", "Python", "use_container", False, "CodeUri"), - ("template.yaml", "Function", True, "python3.10", "Python", "use_container", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.7", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.8", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.9", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.10", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.7", "PythonPEP600", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.8", "PythonPEP600", False, "CodeUri"), ], ) -class TestBuildCommand_PythonFunctions(BuildIntegPythonBase): +class TestBuildCommand_PythonFunctions_WithoutDocker(BuildIntegPythonBase): overrides = True runtime = "python3.9" codeuri = "Python" + check_function_only = False use_container = False + + @pytest.mark.flaky(reruns=3) + def test_with_default_requirements(self): + self._test_with_default_requirements( + self.runtime, + self.codeuri, + self.use_container, + self.test_data_path, + do_override=self.overrides, + check_function_only=self.check_function_only, + ) + + +@skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE) +@parameterized_class( + ( + "template", + "FUNCTION_LOGICAL_ID", + "overrides", + "runtime", + "codeuri", + "check_function_only", + "prop", + ), + [ + ("template.yaml", "Function", True, "python3.7", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.8", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.9", "Python", False, "CodeUri"), + ("template.yaml", "Function", True, "python3.10", "Python", False, "CodeUri"), + ], +) +class TestBuildCommand_PythonFunctions_WithDocker(BuildIntegPythonBase): + overrides = True + runtime = "python3.9" + codeuri = "Python" + use_container = "use_container" check_function_only = False @pytest.mark.flaky(reruns=3) def test_with_default_requirements(self): - if self.use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD): - self.skipTest(SKIP_DOCKER_MESSAGE) self._test_with_default_requirements( self.runtime, self.codeuri, @@ -465,7 +495,9 @@ def test_with_default_requirements(self): ), ], ) -class TestBuildCommand_PythonFunctions_CDK(TestBuildCommand_PythonFunctions): +class TestBuildCommand_PythonFunctions_CDK(TestBuildCommand_PythonFunctions_WithoutDocker): + use_container = False + @pytest.mark.flaky(reruns=3) def test_cdk_app_with_default_requirements(self): self._test_with_default_requirements(