-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test: GHA to Execute Test without Docker Running #5290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1e9931a
5cb6490
cb39abd
6fec858
41a8abe
1325067
79cc8fb
2a298a3
d880ae0
ca6d73d
dcfddb1
92d167d
42c0746
055427a
3f657ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On one: I was asking if this should be a make command. Not a big deal.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. Don't think it needs to be. We have other tests in our actions we run directly through pytest. Don't think we need to abstract them all with make. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we skip all the builds tests without docker?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are tests that don't use Docker, so we don't need to skip them. |
||
| 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( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.