Skip to content
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

Mark extending/add-build-essential-extend/Dockerfile docker example test as XFAIL #38978

Merged
merged 1 commit into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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