-
Notifications
You must be signed in to change notification settings - Fork 0
support optional continue on failure #20
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
Open
cijohnson
wants to merge
6
commits into
main
Choose a base branch
from
ichristo/support_optional_continue_on_failure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
db36070
Support continuing tests with failure.
cijohnson 5542f07
Pass stop_on_errors=False to aghfc and rvs
cijohnson 5896440
Adding sample Unittests for lib module
cijohnson a286a5f
Coming up with makefile to execute UT
cijohnson b402879
Unittest for parallel ssh lib
cijohnson 1192c90
Support to prune unreachable nodes
cijohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| VENV_DIR = test_venv | ||
| PYTHON := $(shell command -v python3 || command -v python) | ||
| PIP = $(VENV_DIR)/bin/pip | ||
|
|
||
| .PHONY: help venv install test clean all clean_venv | ||
| all: venv install test | ||
|
|
||
| help: | ||
| @echo "Available targets:" | ||
| @echo " venv - Create virtual environment" | ||
| @echo " install - Install requirements" | ||
| @echo " test - Test cvs list and cvs generate commands" | ||
| @echo " all - Run venv, install, and test" | ||
| @echo " clean - Remove virtual environment and Python cache files" | ||
|
|
||
| venv: clean_venv | ||
| @echo "Creating virtual environment..." | ||
| $(PYTHON) -m venv $(VENV_DIR) | ||
|
|
||
| install: venv | ||
| @echo "Installing from built distribution..." | ||
| $(PIP) install -r requirements.txt | ||
|
|
||
| test: install | ||
| @echo "Unit Testing cvs..." | ||
| $(VENV_DIR)/bin/python run_all_unittests.py | ||
|
|
||
| clean_venv: | ||
| @echo "Removing virtual environment..." | ||
| @if [ -n "$$VIRTUAL_ENV" ] && [ "$$VIRTUAL_ENV" = "$$(pwd)/$(VENV_DIR)" ]; then \ | ||
| echo "ERROR: You are currently in the venv. Please run 'deactivate' first."; \ | ||
| exit 1; \ | ||
| fi | ||
| rm -rf $(VENV_DIR) | ||
|
|
||
| clean_pycache: | ||
| @echo "Removing Python cache files..." | ||
| find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true | ||
| find . -name "*.pyc" -delete 2>/dev/null || true | ||
| find . -name "*.pyo" -delete 2>/dev/null || true | ||
|
|
||
| clean: clean_venv clean_pycache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
|
|
||
| # Unit Test Organization | ||
|
|
||
| This project separates **unit tests** and **cluster validation tests** to maintain clarity and modularity. | ||
|
|
||
| --- | ||
|
|
||
| ## 📁 Directory Structure | ||
|
|
||
| ``` | ||
| cvs/ | ||
| ├── lib/ | ||
| │ ├── docker_lib.py | ||
| │ ├── utils_lib.py | ||
| │ ├── verify_lib.py | ||
| │ └── unittests/ # Unit tests for lib modules | ||
| │ ├── __init__.py | ||
| │ ├── test_verify_lib.py | ||
| │ └── test_html_lib.py | ||
| ├── tests/ # cluster validation tests (Pytest) | ||
| │ ├── health | ||
| │ ├── ibperf | ||
| │ ├── rccl | ||
| ├── conftest.py | ||
| ├── pytest.ini | ||
| ├── README.md | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## ✅ Unit Tests (using `unittest`) | ||
|
|
||
| - Use Python's built-in `unittest` framework | ||
| - Each test file should be named `test_*.py` | ||
| - Each test class should inherit from `unittest.TestCase` | ||
|
|
||
| ### 🔧 How to Run Unit Tests | ||
|
|
||
| From the project root (`cvs/`): | ||
|
|
||
| ```bash | ||
| python -m unittest discover -s lib/unittests | ||
| ``` | ||
|
|
||
| This will discover and run all unit tests under `lib/unittests/`. | ||
|
|
||
| --- | ||
|
|
||
| ## 🛠️ Run All Unit Tests from Multiple Folders | ||
|
|
||
| If you have multiple unit test folders (e.g., `lib/unittests`, `utils/unittests`), create a script like: | ||
|
|
||
| Run it with: | ||
|
|
||
| ```bash | ||
| python run_all_unittests.py | ||
| test_missing_gpu_key_raises_keyerror (test_html_lib.TestBuildHtmlMemUtilizationTable.test_missing_gpu_key_raises_keyerror) ... Build HTML mem utilization table | ||
| ok | ||
| test_multiple_nodes (test_html_lib.TestBuildHtmlMemUtilizationTable.test_multiple_nodes) ... Build HTML mem utilization table | ||
| ok | ||
| test_rocm7_style_gpu_data (test_html_lib.TestBuildHtmlMemUtilizationTable.test_rocm7_style_gpu_data) ... Build HTML mem utilization table | ||
| ok | ||
| test_single_node_valid_input (test_html_lib.TestBuildHtmlMemUtilizationTable.test_single_node_valid_input) ... Build HTML mem utilization table | ||
| ok | ||
| test_bytes_only (test_html_lib.TestNormalizeBytes.test_bytes_only) ... ok | ||
| test_gigabytes (test_html_lib.TestNormalizeBytes.test_gigabytes) ... ok | ||
| test_kilobytes_binary (test_html_lib.TestNormalizeBytes.test_kilobytes_binary) ... ok | ||
| test_kilobytes_decimal (test_html_lib.TestNormalizeBytes.test_kilobytes_decimal) ... ok | ||
| test_megabytes (test_html_lib.TestNormalizeBytes.test_megabytes) ... ok | ||
| test_negative_bytes (test_html_lib.TestNormalizeBytes.test_negative_bytes) ... ok | ||
| test_precision (test_html_lib.TestNormalizeBytes.test_precision) ... ok | ||
| test_type_error (test_html_lib.TestNormalizeBytes.test_type_error) ... ok | ||
| test_invalid_bus_speed (test_verify_lib.TestVerifyGpuPcieBusWidth.test_invalid_bus_speed) ... ok | ||
| test_valid_bus_width (test_verify_lib.TestVerifyGpuPcieBusWidth.test_valid_bus_width) ... ok | ||
| test_threshold_exceeded (test_verify_lib.TestVerifyGpuPcieErrors.test_threshold_exceeded) ... ok | ||
| test_valid_error_metrics (test_verify_lib.TestVerifyGpuPcieErrors.test_valid_error_metrics) ... ok | ||
|
|
||
| ---------------------------------------------------------------------- | ||
| Ran 16 tests in 0.026s | ||
|
|
||
| OK | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🧪 Tips for Organizing Tests | ||
|
|
||
| - Keep unit tests close to the code they test (e.g., `lib/unittests/`) | ||
| - Use `__init__.py` in all test directories to make them importable | ||
| - Use `unittest.mock` to isolate unit tests from external dependencies | ||
|
|
||
| --- |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the test files need to check this cmd_output for ""Host Unreachable" string and do some action in its phdl obj to remove the bad host ?
Right now, its executing the commands on the bad node as well. and returning with ERROR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No action required by the test scripts, the lib will prune the node itself and inform
cmd_output[host] += "\nABORT: Host Unreachable Error"
i the results.