Skip to content
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
48 changes: 43 additions & 5 deletions .github/workflows/e2e-cluster-lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: E2E Tests(Cluster Lifecycle)
on:
pull_request:
jobs:
cluster-lifecycle-test:
kind-cluster-lifecycle-test:
runs-on: ubuntu-latest

strategy:
Expand All @@ -21,8 +21,8 @@ jobs:
git fetch origin main
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)

if ! echo "$CHANGED_FILES" | grep -qE '^(src/|tests/|default_provided_services/|hacks/|.github/|commons/)'; then
echo "No relevant files changed for cluster-lifecycle-test. Skipping tests but marking success."
if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/kind/|tests/e2e/cluster-life-cycle/kind_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then
echo "No relevant files changed for KIND cluster-lifecycle-test. Skipping tests but marking success."
exit 0
Comment on lines +24 to 26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Directory glob has a typo – tests will be skipped unintentionally

cluster-life-cyclecluster-lifecycle. The current regex never matches the actual paths, so the workflow always short-circuits.

-  if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/kind/|tests/e2e/cluster-life-cycle/kind_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then
+  if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/kind/|tests/e2e/cluster-lifecycle/kind_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then

Make the same correction in the commented-out OpenShift block below.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/kind/|tests/e2e/cluster-life-cycle/kind_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then
echo "No relevant files changed for KIND cluster-lifecycle-test. Skipping tests but marking success."
exit 0
if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/kind/|tests/e2e/cluster-lifecycle/kind_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then
echo "No relevant files changed for KIND cluster-lifecycle-test. Skipping tests but marking success."
exit 0
🤖 Prompt for AI Agents
In .github/workflows/e2e-cluster-lifecycle.yml around lines 24 to 26, the
directory glob pattern 'tests/e2e/cluster-life-cycle/kind_install_delete/'
contains a typo with hyphens instead of the correct 'cluster-lifecycle'. Update
the regex to use 'cluster-lifecycle' to correctly match the intended paths and
prevent unintended skipping of tests. Also, locate the commented-out OpenShift
block in the same file and apply the same correction to its directory glob
pattern.

fi

Expand All @@ -36,8 +36,46 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run E2E Tests
- name: Run E2E KIND Tests
shell: bash
run: |
make e2e-cluster-lifecycle
make e2e-cluster-lifecycle CLUSTER_TYPE=kind

# openshift-local-cluster-lifecycle-test:
# runs-on: ubuntu-latest

# strategy:
# matrix:
# python-version: [3.12]

# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Check changed files for cluster-lifecycle-test
# run: |
# git fetch origin main
# CHANGED_FILES=$(git diff --name-only origin/main...HEAD)

# if ! echo "$CHANGED_FILES" | grep -qE '^(src/roles/clusters/openshift-local/|tests/e2e/cluster-life-cycle/openshift-local_install_delete/|default_provided_services/|hacks/|.github/|commons/)'; then
# echo "No relevant files changed for Openshift Local cluster-lifecycle-test. Skipping tests but marking success."
# exit 0
# fi

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt

# - name: Run E2E Openshift Local Tests
# shell: bash
# run: |
# make e2e-cluster-lifecycle CLUSTER_TYPE=openshift_local NEW_PYTEST_ARGS="-n 1 --dist=loadscope --max-worker-restart=0"

70 changes: 28 additions & 42 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": {
"POD_NAMESPACE": "kserve"
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/cmd/loopy.py",
"console": "integratedTerminal",
"env": { "PYTHONPATH": "src" },
// "args": ["roles", "run", "shell-execute", "-p", "COMMANDS=echo test"]
"args": ["roles", "run", "openshift-local-install", "-g"]
// "args": ["units", "run", "loopy-roles-test-non-cluster-shell-execute"]
},

{
"name": "Attach to Loopy",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
{
"name": "Debug Ginkgo Test(inferenceservice)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/pkg/controller/v1beta1/inferenceservice/rawkube_controller_test.go",
"args": [
"-ginkgo.v",
"-ginkgo.focus", "When creating inference service with raw kube predictor with workerSpec"
],
"env": {
"KUBEBUILDER_ASSETS": "/home/jooho/.local/share/kubebuilder-envtest/k8s/1.29.5-linux-amd64"
}
},
{
"name": "Debug Ginkgo Test(inferenceGraph)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/pkg/controller/v1alpha1/inferencegraph/",
"args": ["-ginkgo.v"],
"env": {
"KUBEBUILDER_ASSETS": "/home/jooho/.local/share/kubebuilder-envtest/k8s/1.29.5-linux-amd64"
}
}
]
}

"justMyCode": false
}
]
}
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
IMG=quay.io/jooholee/loopy
IMG_TAG=latest

PYTEST_CONFIG ?= "pytest.ini"
TEST_ENV ?= "local"
PYTEST_CONFIG ?= pytest.ini
TEST_ENV ?= local
PYTEST_ARGS ?= -n 3 --dist=loadscope

.PHONY: build push
build:
Expand Down Expand Up @@ -41,7 +42,13 @@ e2e: download-cli
.PHONY: e2e-cluster-lifecycle
e2e-cluster-lifecycle: download-cli
export PATH="$(CURDIR)/bin:$(PATH)" ;\
pytest -c "${PYTEST_CONFIG}" -n 1 --dist worksteal -m cluster_life_cycle_tests
if [ -n "$(NEW_PYTEST_ARGS)" ]; then \
FINAL_PYTEST_ARGS="$(NEW_PYTEST_ARGS)"; \
else \
FINAL_PYTEST_ARGS="$(PYTEST_ARGS)"; \
fi ;\
pytest -c "${PYTEST_CONFIG}" $$FINAL_PYTEST_ARGS -m "(${CLUSTER_TYPE}) and cluster_lifecycle_tests"


.PHONY: update-test-data
update-test-data:
Expand Down
1 change: 0 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ output_root_dir: /tmp/ms_cli
output_env_dir: output
output_artifacts_dir: artifacts
output_report_file: report
show_debug_log: false
stop_when_failed: false
stop_when_error_happened: false
enable_loopy_report: true
Expand Down
14 changes: 13 additions & 1 deletion hacks/download-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,22 @@ if [[ $TEST_ENV == "local" ]]; then
echo "⬇️ Downloading kind (Latest)..."
wget --progress=bar:force:noscroll "https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64" -O kind
chmod +x kind
rm -rf "${root_directory}/bin/kind"
delete_if_exists "${root_directory}/bin/kind"
mv kind "${root_directory}/bin/kind"
echo "✅ kind installed successfully!"
fi

# Install crc
if ! check_binary_exists "${root_directory}/bin/crc"; then
echo "⬇️ Downloading crc (latest)..."
curl -L https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz | tar -xJ

chmod +x crc-linux-*/crc
delete_if_exists "${root_directory}/bin/crc"
mv crc-linux-*/crc "${root_directory}/bin/crc"
rm -rf "crc-linux-*"
echo "✅ openshift local(crc) installed successfully!"
fi
fi


Expand Down
6 changes: 5 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ markers =

cluster_tests: tests needs a cluster(run)
non_cluster_tests: tests does not need a cluster(run)
cluster_life_cycle_tests: tests for cluster life cycle
cluster_lifecycle_tests: tests for cluster lifecycle

# CLUSTER_TYPE: kind, crc, openshift-local
kind: tests for kind cluster lifecycle
openshift_local: tests for openshift-local cluster lifecycle

filterwarnings =
ignore::pytest.PytestCollectionWarning
Expand Down
3 changes: 2 additions & 1 deletion src/cli/logics/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ def export_env_variables(ctx, input_variabels):
os.environ["STOP_WHEN_FAILED"] = str(ctx.obj.config["stop_when_failed"])

for input_var in input_variabels:
os.environ[input_var] = input_variabels[input_var]
# Convert all values to string
os.environ[input_var] = str(input_variabels[input_var])

logger.info(f"{Fore.GREEN} \u21b3 Successfully export input variables {Fore.RESET}")

Expand Down
Loading
Loading