Skip to content

Commit

Permalink
Mark extending/add-build-essential-extend/Dockerfile docker example…
Browse files Browse the repository at this point in the history
… test as XFAIL
  • Loading branch information
Taragolis committed Apr 13, 2024
1 parent 67ad95f commit eb9f7d7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/additional-prod-image-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

test-examples-of-prod-image-building:
timeout-minutes: 60
name: "Test examples of POD image building"
name: "Test examples of PROD image building"
runs-on: ${{ fromJSON(inputs.runs-on-as-json-public) }}
env:
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down
28 changes: 24 additions & 4 deletions docker_tests/test_examples_of_prod_image_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,30 @@ def test_shell_script_example(script_file):
run_command(["bash", script_file])


@pytest.mark.parametrize("dockerfile", glob.glob(f"{DOCKER_EXAMPLES_DIR}/**/Dockerfile", recursive=True))
def test_dockerfile_example(dockerfile, tmp_path):
rel_dockerfile_path = Path(dockerfile).relative_to(DOCKER_EXAMPLES_DIR)
image_name = str(rel_dockerfile_path).lower().replace("/", "-")
def docker_examples(directory: Path, xfails: list[str] | None = None):
xfails = xfails or []
result = []
for filepath in sorted(directory.rglob("**/Dockerfile")):
markers = []
rel_path = filepath.relative_to(directory).as_posix()
if rel_path in xfails:
markers.append(pytest.mark.xfail)
result.append(pytest.param(filepath, rel_path, marks=markers, id=rel_path))
return result


@pytest.mark.parametrize(
"dockerfile, relative_path",
docker_examples(
DOCKER_EXAMPLES_DIR,
xfails=[
# FIXME https://github.com/apache/airflow/issues/38988
"extending/add-build-essential-extend/Dockerfile",
],
),
)
def test_dockerfile_example(dockerfile, relative_path, tmp_path):
image_name = relative_path.lower().replace("/", "-")
content = Path(dockerfile).read_text()
test_image = os.environ.get("TEST_IMAGE", get_latest_airflow_image())

Expand Down

0 comments on commit eb9f7d7

Please sign in to comment.