openshift-virtualization-tests is a public repository under the RedHatQE organization on GitHub.
The project is structured as follows:
- tests: Base directory for pytest tests
- Each component has its own directory
- Each feature has its own directory
- utilities: Base directory for utility functions
- docs: Documentation
- py_config contains tests-specific configuration which can be controlled from the command line. Please refer to pytest-testconfig for more information.
To contribute code to the project:
- Fork the project and work on your forked repository
- Before submitting a new pull request:
- Make sure you follow the Coding and Style Guide
- Check the prerequisites section under the Development section
- PRs that are not ready for review (but needed to be pushed for any reason) should be set as
Draftin GitHub.- When a PR is ready for review, mark it as ready for review.
- PRs should be relatively small; if needed, the PRs should be split and depend on each other.
- Small PRs will get quicker review.
- Small PRs comments will be fixed quicker and merged quicker.
- Both the reviewer and the committer will benefit from this.
- When a refactor is needed as part of the current PR, the refactor should be done in another PR and the current PR should be rebased on it.
- Please address each comment in code review
- If a comment is addressed and accepted:
- The author should comment “done” and add 👍 if they agree with the resolution.
- The author can then mark that comment as
resolved.
- If a comment was addressed and rejected or additional discussion is needed, add your input and do not resolve the comment.
- To minimize the number of comments, please try to address all comments in one PR.
- If a comment is addressed and accepted:
- The repository is using CodeRabbit for PR reviews; all comments must be addressed in the PR.
- Before a PR can be merged:
- PRs must be verified and marked with "verified" label.
- PRs must be reviewed and approved (by adding
/lgtmcomment or using GitHubs' approve) by at least two reviewers other than the committer. For the PR to be merged, the accepted reviewers are the ones that appear in the modified code'sOWNERSfile or root approvers. - PRs must be approved (by adding
/approvecomment) by at least one of the approvers in the rootOWNERSfile. If theOWNERSfile relevant to the modified code containsroot-approvers: False, the approvers in the rootOWNERSfile are not required to approve the PR.
- PRs must be reviewed and approved (by adding
- All CI checks must pass.
- If
can-be-mergedcheck is marked as failed, check the job to see the reason(s).
- If
- PRs must be verified and marked with "verified" label.
The project follows Red Hat Openshift Virtualization versions lifecycle.
If needed, once your PR is merged to main, cherry-pick your PR to the relevant branch(es).
- Make sure you have pre-commit package installed
- Make sure you have tox package installed
- Refer to the coding_and_style guide for style guide rules.
The project utilizes openshift-python-wrapper. Please refer to the documentation and the examples for more information.
Determining the depth of verification steps for each patch is left for the author and their reviewer. It's required that the procedure used to verify a patch is listed in comments to the review request.
We use check tools that are defined in .pre-commit-config.yaml file To install pre-commit:
pip install pre-commit --user
pre-commit installRun pre-commit:
pre-commit run --all-filespre-commit will try to fix the errors. If some errors where fixed, git add & git commit is needed again. commit-msg uses gitlint (https://jorisroovers.com/gitlint/)
CI uses tox and will run the code under tox.ini To check for issues locally run:
toxIt is essential to have a good commit message if you want your change to be reviewed.
- Write a short one-line summary
- Use the present tense (fix instead of fixed)
- Use the past tense when describing the status before this commit
- Add a link to the related jira card (required for any significant automation work)
jira-ticket: https://issues.redhat.com/browse/<jira_id>- The card will be automatically closed once PR is merged
Comment on your GitHub PR:
/build-and-push-containerYou can add additional arguments when creating the container. Supported arguments can be found in the Dockerfile and Makefile of the openshift-virtualization-tests repository.
For example, this command will create a container with the openshift-virtualization-tests PR it was run against and a specific commit of a wrapper PR:
/build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=<commit_hash>Container created with the /build-and-push-container command is automatically pushed to quay and can be used by
Jenkins test jobs for verification (see Run the Jenkins test jobs for openshift-virtualization-tests section for more details).
Open relevant test jobs in jenkins
Click on Build with Parameters.
Under CLUSTER_NAME enter your cluster's name.
Under IMAGE_TAG enter your image tag, example: openshift-virtualization-tests-github:pr-<pr_number>
This same field can be used to test a specific container created from an openshift-virtualization-tests PR.
To pass parameters to pytest command add them to PYTEST_PARAMS.
for example -k 'network' will run only tests that match 'network' keyword