Skip to content
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
15 changes: 15 additions & 0 deletions .github/workflows/one_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ jobs:
fi
go build "${packages[@]}"

test-python:
needs: [changes, authorize]
if: needs.changes.outputs.should_build == 'true'
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Test Python
run: make test-python

build-soperator-images:
needs:
- changes
Expand Down Expand Up @@ -846,6 +860,7 @@ jobs:
- pre-build
- lint
- build-e2e
- test-python
- build-slurm-images
- build-soperator-images
- manifest-populate-jail
Expand Down
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,28 @@ test: manifests generate fmt vet envtest ## Run tests.
go test ./...

.PHONY: test-python
test-python: ## Temporarily retained while removing Python unit tests from CI.
@echo "Python unit tests are disabled in CI."
test-python: ## Run all Python unit tests.
@found=false; \
while IFS= read -r -d '' test_file; do \
found=true; \
test_dir=$$(dirname "$$test_file"); \
test_pattern=$$(basename "$$test_file"); \
echo "Running Python unit tests in $$test_file"; \
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover \
-s "$$test_dir" \
-p "$$test_pattern" \
-v; \
done < <(find . \
-type d \( \
-name .git -o \
-name .venv -o \
-name venv -o \
-name __pycache__ \
\) -prune -o \
-type f \( -name '*_test.py' -o -name 'test_*.py' \) -print0); \
if [ "$$found" = false ]; then \
echo "No Python unit tests found; skipping."; \
fi

.PHONY: test-coverage
test-coverage: manifests generate fmt vet envtest ## Run tests and generate test coverage.
Expand Down
8 changes: 6 additions & 2 deletions images/worker/worker_init_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,9 @@ def test_non_gpu_applies_per_fabric_unknown_topology(
worker_init.wait_for_topology()

mock_apply.assert_called_once_with(
"worker-0", "topology=default:fab-a:fab-a.unknown"
"worker-0",
"topology=default:fab-a:fab-a.unknown",
worker_init.TOPOLOGY_PLUGIN_TREE,
)

@mock.patch("worker_init.wait_for_hostname_in_topology_conf")
Expand All @@ -915,7 +917,9 @@ def test_non_gpu_applies_per_fabric_unknown_block(
worker_init.wait_for_topology()

mock_apply.assert_called_once_with(
"worker-0", "topology=default:fab-a.unknown"
"worker-0",
"topology=default:fab-a.unknown",
worker_init.TOPOLOGY_PLUGIN_BLOCK,
)

@mock.patch("worker_init.wait_for_hostname_in_topology_conf")
Expand Down
Loading