diff --git a/.github/workflows/run-generation-tests.yaml b/.github/workflows/run-generation-tests.yaml deleted file mode 100644 index 7d9bafe4..00000000 --- a/.github/workflows/run-generation-tests.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: Generation Tests - -on: - workflow_dispatch: - pull_request: - push: - branches: - - main - -jobs: - changes: - runs-on: ubuntu-latest - # # Required permissions - # permissions: - # pull-requests: read - # # Set job outputs to values from filter step - outputs: - relevant_files: ${{ steps.filter.outputs.relevant_files }} - steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - relevant_files: - - 'minilayer/devcontainer/feature_generation**' - - 'tests/minilayer/feature_generation**' - - run-tests: - needs: [changes] - if: ${{ (needs.changes.outputs.relevant_files == 'true') || (github.event_name == 'workflow_dispatch') }} - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: "Install latest devcontainer CLI" - run: npm install -g @devcontainers/cli - - - - name: "Set up Python 3.8" - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: "Install python dependencies" - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade build setuptools wheel setuptools-scm - pip install -r requirements.txt -r requirements-generate.txt -r requirements-dev.txt - - name: "Test with pytest" - run: | - python -m pytest -s -v tests/devcontainer/feature_generation \ No newline at end of file diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 940ed6cd..81b7a132 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -75,7 +75,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install --upgrade build setuptools wheel setuptools-scm - pip install -r requirements.txt -r requirements-generate.txt -r requirements-dev.txt + pip install -r requirements.txt -r requirements-dev.txt - name: "Test with pytest" run: | - python -m pytest -s -v ${{ matrix.config.subtest_dir }} --ignore=tests/devcontainer/feature_generation \ No newline at end of file + python -m pytest -s -v ${{ matrix.config.subtest_dir }} \ No newline at end of file diff --git a/tests/devcontainer/feature_generation/test_oci_feature_generator.py b/tests/devcontainer/feature_generation/test_oci_feature_generator.py deleted file mode 100644 index 25bd29f8..00000000 --- a/tests/devcontainer/feature_generation/test_oci_feature_generator.py +++ /dev/null @@ -1,81 +0,0 @@ -import os -import pathlib - -import pytest -from helpers import RESOURCE_DIR - -from minilayer.devcontainer.feature_generation.oci_feature_generator import ( - OCIFeatureGenerator, -) - -FEATURE_DEFINITION_DIR = os.path.join(RESOURCE_DIR, "test_feature_definitions") - - -TEST_IMAGE = "mcr.microsoft.com/devcontainers/base:debian" - - -@pytest.mark.parametrize( - "feature_id,feature_definition_dir,release_version", - [ - (v, os.path.join(FEATURE_DEFINITION_DIR, v), "v0.3.7rc7") - for v in os.listdir(FEATURE_DEFINITION_DIR) - ], -) -def test_feature_dir_generation( - shell, - tmp_path: pathlib.Path, - feature_id: str, - feature_definition_dir: str, - release_version: str, -) -> None: - feature_definition = os.path.join(feature_definition_dir, "feature-definition.json") - - tmp_path_str = tmp_path.as_posix() - OCIFeatureGenerator.generate( - feature_definition=feature_definition, - output_dir=tmp_path.as_posix(), - release_version=release_version, - ) - - assert os.path.isfile( - os.path.join(tmp_path_str, "test", feature_id, "scenarios.json") - ) - assert os.path.isfile( - os.path.join(tmp_path_str, "src", feature_id, "library_scripts.sh") - ) - assert os.path.isfile( - os.path.join(tmp_path_str, "src", feature_id, "devcontainer-feature.json") - ) - assert os.path.isfile(os.path.join(tmp_path_str, "src", feature_id, "install.sh")) - - -@pytest.mark.parametrize( - "feature_id,feature_definition_dir,release_version", - [ - (v, os.path.join(FEATURE_DEFINITION_DIR, v), "v0.3.7rc7") - for v in os.listdir(FEATURE_DEFINITION_DIR) - ], -) -def test_feature_dir_generation_and_run_devcontainer_tests( - shell, - tmp_path: pathlib.Path, - feature_id: str, - feature_definition_dir: str, - release_version: str, -) -> None: - feature_definition = os.path.join(feature_definition_dir, "feature-definition.json") - - tmp_path_str = tmp_path.as_posix() - OCIFeatureGenerator.generate( - feature_definition=feature_definition, - output_dir=tmp_path_str, - release_version=release_version, - ) - response = shell.run( - f"BUILDKIT_PROGRESS=plain devcontainer features test -p {tmp_path_str} -f {feature_id} --skip-autogenerated", - shell=True, - ) - print(response.stdout) - print(response.stderr) - - assert response.exitcode == 0