Skip to content

Commit ed59a8d

Browse files
authored
Merge branch 'main' into smoke-refactor
2 parents 2706849 + c799aa0 commit ed59a8d

15 files changed

Lines changed: 116 additions & 37 deletions

.github/pull_request_template.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Pull Request
2+
13
## Summary
24

35
<!-- Brief description of changes and why they are needed -->

.github/workflows/workflow-review.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,29 @@ jobs:
2020

2121
steps:
2222
- name: save the pr information
23+
env:
24+
COMMENT_BODY: ${{ github.event.comment.body }}
25+
REVIEW_BODY: ${{ github.event.review.body }}
26+
USER_LOGIN: ${{ github.event.sender.login }}
2327
run: |
24-
printf '{
25-
"pr_num": "${{ github.event.pull_request.number || github.event.issue.number }}",
26-
"event_action": "${{ github.event.action }}",
27-
"review_state": "${{ github.event.review.state }}",
28-
"event_name": "${{ github.event_name }}",
29-
"comment_body": "${{ github.event.comment.body }}",
30-
"review_comment_body": "${{ github.event.review.body }}",
31-
"user_login": "${{ github.event.sender.login }}",
32-
"action": "add-remove-labels"
28+
jq -n \
29+
--arg pr_num "${{ github.event.pull_request.number || github.event.issue.number }}" \
30+
--arg event_action "${{ github.event.action }}" \
31+
--arg review_state "${{ github.event.review.state }}" \
32+
--arg event_name "${{ github.event_name }}" \
33+
--arg comment_body "$COMMENT_BODY" \
34+
--arg review_comment_body "$REVIEW_BODY" \
35+
--arg user_login "$USER_LOGIN" \
36+
--arg action "add-remove-labels" \
37+
'{
38+
pr_num: $pr_num,
39+
event_action: $event_action,
40+
review_state: $review_state,
41+
event_name: $event_name,
42+
comment_body: $comment_body,
43+
review_comment_body: $review_comment_body,
44+
user_login: $user_login,
45+
action: $action
3346
}' >> context.json
3447
- uses: actions/upload-artifact@v6
3548
with:

.markdownlint.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
"MD003": { "style": "atx" },
4+
"MD004": false,
5+
"MD007": false,
6+
"MD010": {"code_blocks": false},
7+
"MD013": false,
8+
"MD026": {"punctuation": ".,;!。,;:!"},
9+
"MD029": false,
10+
"MD051": false,
11+
"no-hard-tabs": false,
12+
"whitespace": false
13+
}

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,23 @@ repos:
7171
- --types=build,ci,chore,docs,feat,fix,perf,refactor,revert,style,test
7272
- --subject-min-length=10
7373
- --subject-max-length=80
74+
7475
- repo: local
7576
hooks:
7677
- id: check-prohibited-patterns
7778
name: Check for prohibited code patterns
7879
entry: python scripts/check_incorrect_wrapper_usage.py
7980
language: python
8081
pass_filenames: false
82+
83+
- repo: https://github.com/rhysd/actionlint
84+
rev: v1.7.4
85+
hooks:
86+
- id: actionlint
87+
88+
- repo: https://github.com/DavidAnson/markdownlint-cli2
89+
rev: v0.21.0
90+
hooks:
91+
- id: markdownlint-cli2
92+
args:
93+
- --fix

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ You are an expert QE engineer writing maintainable pytest tests that other engin
88
## Commands
99

1010
### Validation (run before committing)
11+
1112
```bash
1213
# Run all pre-commit checks
1314
pre-commit run --all-files
@@ -17,6 +18,7 @@ tox
1718
```
1819

1920
### Test Execution
21+
2022
```bash
2123
# Collect tests without running (verify structure)
2224
uv run pytest --collect-only
@@ -45,17 +47,20 @@ utilities/ # Shared utility functions
4547
## Essential Patterns
4648

4749
### Tests
50+
4851
- Every test MUST have a docstring explaining what it tests (see `tests/cluster_health/test_cluster_health.py`)
4952
- Apply relevant markers from `pytest.ini`: tier (`smoke`, `sanity`, `tier1`, `tier2`), component (`model_serving`, `model_registry`, `llama_stack`), infrastructure (`gpu`, `parallel`, `slow`)
5053
- Use Given-When-Then format in docstrings for behavioral clarity
5154

5255
### Fixtures
56+
5357
- Fixture names MUST be nouns: `storage_secret` not `create_secret`
5458
- Use context managers for resource lifecycle (see `tests/conftest.py:544-550` for pattern)
5559
- Fixtures do one thing only—compose them rather than nesting
5660
- Use narrowest scope that meets the need: function > class > module > session
5761

5862
### Kubernetes Resources
63+
5964
- Use [openshift-python-wrapper](https://github.com/RedHatQE/openshift-python-wrapper) for all K8s API calls
6065
- Resource lifecycle MUST use context managers to ensure cleanup
6166
- Use `oc` CLI only when wrapper is not relevant (e.g., must-gather)
@@ -70,19 +75,22 @@ utilities/ # Shared utility functions
7075
## Boundaries
7176

7277
### ✅ Always
78+
7379
- Follow existing patterns before introducing new approaches
7480
- Add type annotations (mypy strict enforced)
7581
- Write Google-format docstrings for tests and fixtures
7682
- Run `pre-commit run --all-files` before suggesting changes
7783

7884
### ⚠️ Ask First
85+
7986
- Adding new dependencies to `pyproject.toml`
8087
- Creating new `conftest.py` files
8188
- Moving fixtures to shared locations
8289
- Adding new markers to `pytest.ini`
8390
- Modifying session-scoped fixtures
8491

8592
### 🚫 Never
93+
8694
- Remove or modify existing tests without explicit request
8795
- Add code that isn't immediately used (YAGNI)
8896
- Log secrets, tokens, or credentials
@@ -92,6 +100,7 @@ utilities/ # Shared utility functions
92100
## Documentation Reference
93101

94102
Consult these for detailed guidance:
103+
95104
- [Constitution](./CONSTITUTION.md) - Non-negotiable principles (supersedes all other docs)
96105
- [Developer Guide](./docs/DEVELOPER_GUIDE.md) - Contribution workflow, fixture examples
97106
- [Style Guide](./docs/STYLE_GUIDE.md) - Naming, typing, docstrings

CONSTITUTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ No versioning policy is enforced.
156156
### Guidance Reference
157157

158158
For development runtime guidance, consult:
159+
159160
- [AGENTS.md](./AGENTS.md) for AI assistant instructions
160161
- [DEVELOPER_GUIDE.md](./docs/DEVELOPER_GUIDE.md) for contribution details
161162
- [STYLE_GUIDE.md](./docs/STYLE_GUIDE.md) for code style

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
This repository contains ODH / Red Hat Openshift AI (RHOAI) tests.
44
The tests are written in Python and use [pytest](https://docs.pytest.org/en/stable/) as a test framework.
55

6-
76
## Getting started
7+
88
Please follow the [Getting Started Guide](docs/GETTING_STARTED.md) on how to run the tests.
99

10+
1011
## Example of upgrade testing
12+
1113
Please follow the [Upgrade Guide](docs/UPGRADE.md) on how to run the upgrade tests.
1214

1315

1416
## Contribute to opendatahub-tests
15-
Please follow the [Contributing Guide](docs/CONTRIBUTING.md) and the [Developer guide](docs/DEVELOPER_GUIDE.md)
1617

18+
Please follow the [Contributing Guide](docs/CONTRIBUTING.md) and the [Developer guide](docs/DEVELOPER_GUIDE.md)
1719

1820
## GitHub workflows
21+
1922
Please follow the [GitHub workflows Guide](docs/GITHUB_WORKFLOWS.md) for more information.

VSCODE_CONFIG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ to `"mypy-type-checker.args" = ["--config-file=pyproject.toml"]`.
1313
If you use Visual Studio Code and want to debug your test execution with its "Run and Debug" feature, you'll want to use
1414
a `launch.json` file similar to this one:
1515

16-
```
16+
```json
1717
{
1818
// Use IntelliSense to learn about possible attributes.
1919
// Hover to view descriptions of existing attributes.

docs/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ If you open a pull request to fix the problem, an issue will ba automatically cr
1515
If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/opendatahub-io/opendatahub-tests/issues/new/choose).
1616

1717
## Pull requests
18+
1819
Follow the guidelines in [Developer guide](DEVELOPER_GUIDE.md)

docs/DEVELOPER_GUIDE.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Project Structure
22

33
The project is structured as follows:
4+
45
- [tests](../tests): Base directory for pytest tests
56
- Each component has its own directory
67
- Each feature has its own directory
@@ -12,11 +13,12 @@ The project is structured as follows:
1213
- [py_config](../tests/global_config.py) contains tests-specific configuration which can be controlled from the command line.
1314
Please refer to [pytest-testconfig](https://github.com/wojole/pytest-testconfig) for more information.
1415

16+
## Contribution
1517

16-
# Contribution
1718
To contribute code to the project:
1819

1920
## Pull requests
21+
2022
- Fork the project and work on your forked repository
2123
- Before submitting a new pull request:
2224
- Make sure you follow the [Style guide](STYLE_GUIDE.md)
@@ -40,11 +42,12 @@ To contribute code to the project:
4042
- All CI checks must pass.
4143

4244
## Branching strategy
43-
The project follows RHOAI [release lifecyle strategy](https://access.redhat.com/support/policy/updates/rhoai-sm/lifecycle).
44-
If needed, once your PR is merged to `main`, cherry-pick your PR to the relevant branch(es).
4545

46+
The project follows RHOAI [release lifecycle strategy](https://access.redhat.com/support/policy/updates/rhoai-sm/lifecycle).
47+
If needed, once your PR is merged to `main`, cherry-pick your PR to the relevant branch(es).
4648

4749
## Python
50+
4851
- Reduce duplicate code, before writing new function search for it, probably someone already wrote it or one that should serve your needs.
4952
- The project uses external packages that may already have a functionality that does what you need.
5053
- When using a variable more than once save it and reuse.
@@ -60,8 +63,8 @@ If needed, once your PR is merged to `main`, cherry-pick your PR to the relevant
6063
- Log enough to make you debug and understand the flow easy, but do not spam the log with unuseful info.
6164
Error logs should be detailed with what failed, status and so on.
6265

63-
6466
## Interacting with Kubernetes/OpenShift APIs
67+
6568
The project utilizes [openshift-python-wrapper](https://github.com/RedHatQE/openshift-python-wrapper).
6669
Please refer to the [documentation](https://github.com/RedHatQE/openshift-python-wrapper/blob/main/README.md)
6770
and the [examples](https://github.com/RedHatQE/openshift-python-wrapper/tree/main/examples) for more information.
@@ -72,14 +75,14 @@ create a PR against wrapper. Calls to cluster resources from tests, utils and fi
7275
openshift-python-wrapper resource or oc command
7376
(when wrapper resource is not relevant. e.g. must-gather generation)
7477

75-
7678
## Conftest
79+
7780
- Top level [conftest.py](../conftest.py) contains pytest native fixtures.
7881
- General tests [conftest.py](../tests/conftest.py) contains fixtures that are used in multiple tests by multiple teams.
7982
- If needed, create new `conftest.py` files in the relevant directories.
8083

81-
8284
## Fixtures
85+
8386
- Ordering: Always call pytest native fixtures first, then session-scoped fixtures and then any other fixtures.
8487
- Fixtures should handle setup (and the teardown, if needed) needed for the test(s), including the creation of resources for example.
8588
- Fixtures should do one thing only.
@@ -136,21 +139,21 @@ def storage_secret(request):
136139
secret = Secret(name=request.param["name"], model_dir=request.param["model-dir"])
137140
```
138141

139-
140142
## Tests
143+
141144
- Pytest reports failures in fixtures as FAILED
142145
- Each test should have a clear purpose and should be easy to understand.
143146
- Each test should verify a single aspect of the product.
144147
- Preferably, each test should be independent of other tests.
145-
- When there's a dependency between tests use pytest dependency plugin to mark the relevant hierarchy between tests (https://github.com/RKrahl/pytest-dependency)
148+
- When there's a dependency between tests use pytest dependency plugin to mark the relevant hierarchy between tests ([pytest-dependency](https://github.com/RKrahl/pytest-dependency))
146149
- When adding a new test, apply relevant marker(s) which may apply.
147150
Check [pytest.ini](../pytest.ini) for available markers; additional markers can always be added when needed.
148151
- Classes are good to group related tests together, for example when they share a fixture.
149152
You should NOT group unrelated tests in one class (because it is misleading the reader).
150-
- All the tests should be properly documented. Every test (or test class), should have a docstring explaning what the test does so that anyone (engineers from other components, managers, PMs, or non-technical users) can have a basic understanding of what the code is trying to test without having to dive into the technical details of related functions or fixtures.
151-
153+
- All the tests should be properly documented. Every test (or test class), should have a docstring explaining what the test does so that anyone (engineers from other components, managers, PMs, or non-technical users) can have a basic understanding of what the code is trying to test without having to dive into the technical details of related functions or fixtures.
152154

153155
## Check the code
156+
154157
### pre-commit
155158

156159
When submitting a pull request, make sure to fill all the required, relevant fields for your PR.
@@ -169,6 +172,7 @@ pre-commit run --all-files
169172
```
170173

171174
### tox
175+
172176
CI uses [tox](https://tox.readthedocs.io/en/latest/) and will run the code under tox.ini
173177

174178
Run tox:
@@ -178,9 +182,12 @@ tox
178182
```
179183

180184
## Adding new runtime
181-
To add a new runtime, you need to:
185+
186+
To add a new runtime, you need to:
187+
182188
1. Add a new file under [manifests](../utilities/manifests) directory.
183189
2. Add `<runtime>_INFERENCE_CONFIG` dict with:
190+
184191
```code
185192
"support_multi_default_queries": True|False, # Optioanl, if set to True, `default_query_model` should contains a dict with corresponding inference_type
186193
"default_query_model": {
@@ -199,12 +206,16 @@ To add a new runtime, you need to:
199206
},
200207
},
201208
```
209+
202210
3. See [caikit_standalone](../utilities/manifests/caikit_standalone.py) for an example
203211

204212
## AI Usage
213+
205214
If using AI tooling to assist you in the process of writing or reviewing code:
215+
206216
1. Understand what you are doing --as a developer, you are ultimately responsible for the code. Always assume the code produced by the AI tools is unsafe and incorrect, and always double-check it.
207217
2. We support [AGENTS.md](../AGENTS.md), an [open format](https://agents.md/) for guiding coding agents. If you use any proprietary tool that does not support `AGENTS.md` (e.g. Claude Code, Qwen Code, Gemini Code), you can create a symlink:
218+
208219
```bash
209220
ln -s AGENTS.md CLAUDE.md
210221
```

0 commit comments

Comments
 (0)