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 one test from docker backend as platform-specific behaviour #21621

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ jobs:
with:
distribution: adopt
java-version: '11'
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.19.5
- name: Download native binaries
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -1854,6 +1858,8 @@ jobs:
with:
distribution: adopt
java-version: '11'
- name: Install Docker
run: brew install docker
- name: Set up Python 3.7, 3.8, 3.9, 3.10, 3.12, 3.13, 3.11
uses: actions/setup-python@v5
with:
Expand Down
10 changes: 9 additions & 1 deletion src/python/pants/backend/docker/goals/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources()
python_tests(name="tests", timeout=200)
python_tests(
name="tests",
timeout=200,
overrides={
"package_image_integration_test.py": {
"tags": ["platform_specific_behavior"],
}
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def run_docker(
return result


@pytest.mark.platform_specific_behavior
def test_docker_build(rule_runner: RuleRunner) -> None:
"""This test requires a running docker daemon."""
rule_runner.write_files(
Expand Down
9 changes: 8 additions & 1 deletion src/python/pants/backend/docker/lint/hadolint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources()
python_tests(name="tests")
python_tests(
name="tests",
overrides={
"rules_integration_test.py": {
"tags": ["platform_specific_behavior"],
}
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_passing(rule_runner: RuleRunner) -> None:
assert_success(rule_runner, tgt)


@pytest.mark.platform_specific_behavior
def test_failing(rule_runner: RuleRunner) -> None:
rule_runner.write_files({"Dockerfile": BAD_FILE, "BUILD": "docker_image(name='t')"})
tgt = rule_runner.get_target(Address("", target_name="t"))
Expand Down
10 changes: 9 additions & 1 deletion src/python/pants/backend/go/lint/golangci_lint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_sources()
python_tests(name="tests", timeout=120)
python_tests(
name="tests",
timeout=120,
overrides={
"rules_integration_test.py": {
"tags": ["platform_specific_behavior"],
}
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_passing(rule_runner: RuleRunner) -> None:
assert lint_results[0].stderr == ""


@pytest.mark.platform_specific_behavior
def test_failing(rule_runner: RuleRunner) -> None:
rule_runner.write_files(
{
Expand Down
11 changes: 10 additions & 1 deletion src/python/pants_release/generate_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class Platform(Enum):
SELF_HOSTED = {Platform.LINUX_ARM64, Platform.MACOS11_ARM64}
# We control these runners, so we preinstall and expose python on them.
HAS_PYTHON = {Platform.LINUX_ARM64, Platform.MACOS11_ARM64}
HAS_GO = {Platform.MACOS12_X86_64, Platform.MACOS11_ARM64}
HAS_DOCKER = {Platform.LINUX_ARM64, Platform.LINUX_X86_64, Platform.MACOS11_ARM64}
CARGO_AUDIT_IGNORED_ADVISORY_IDS = (
"RUSTSEC-2020-0128", # returns a false positive on the cache crate, which is a local crate not a 3rd party crate
)
Expand Down Expand Up @@ -372,6 +374,11 @@ def install_go(node16_compat: bool = False) -> Step:
"with": {"go-version": "1.19.5"},
}

def install_docker_with_brew() -> Step:
return {
"name": "Install Docker",
"run": "brew install docker",
}

# NOTE: Any updates to the version of arduino/setup-protoc will require an audit of the updated source code to verify
# nothing "bad" has been added to the action. (We pass the user's GitHub secret to the action in order to avoid the
Expand Down Expand Up @@ -740,8 +747,10 @@ def test_jobs(
*checkout(),
*(launch_bazel_remote() if with_remote_caching else []),
install_jdk(),
*([install_go()] if helper.platform not in HAS_GO else []),
*([install_docker_with_brew()] if helper.platform not in HAS_DOCKER else []),
*(
[install_go(), download_apache_thrift()]
[download_apache_thrift()]
if helper.platform == Platform.LINUX_X86_64
# Other platforms either don't run those tests, or have the binaries
# preinstalled on the self-hosted runners.
Expand Down
Loading