Skip to content
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

Update Testing Documentation #88

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
21 changes: 20 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,23 @@ Fixes #?
Documentation
- [ ] Does the registry operator documentation need to be updated with your changes?

**How to test changes / Special notes to the reviewer**:
<!--
Instructions for locally testing changes made to the operator, drawn from CONTRIBUTING.md
-->
**Testing changes**

Unit Tests:
- Run `make test` from root of the repository.

<!--
Will need to be updated after the completion of https://github.com/devfile/api/issues/1523
-->
Integration Tests:
thepetk marked this conversation as resolved.
Show resolved Hide resolved
- Run `make install-cert` and wait for pods in `cert-manager` namespace.
- Run `make install && make deploy` and wait for pods in `registry-operator-system` namespace.
- Run `make test-integration`.

<!--
Add extra instructions that reviewers may need regarding testing your changes or to properly review your pull request.
-->
**Special notes to the reviewer**:
19 changes: 14 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,21 @@ The unit tests for this repository are located under the `pkg/` folder and are d

The integration tests for this repository are located under the `tests/integration` folder and contain tests that validate the Operator's functionality when running on an OpenShift cluster.

To run these tests, run the following commands:
One of the `oc` or `kubectl` executables must be accessible. If both are present in your path, `oc` will be used, except if you
define the environment variable `K8S_CLI` with the command you prefer to use.

```bash
export IMG=<your-built-operator-image>
make test-integration
```
By default, the tests will use the default image for the operator, `quay.io/devfile/registry-operator:next`.

You can use `make <engine>-build` to build your own image, `make <engine>-push` to publish it - Replace `<engine>` with `podman` or `docker`. You will need to have a reference to your newly built image available via the `IMG` environment variable.

<!--
Will need to be updated after the completion of https://github.com/devfile/api/issues/1523
-->
In order for `make test-integration` to properly run you must first ensure your environment is prepared for the operator. The following steps should be done **before** running `make test-integration` and
these commands should be run from the root of the repository where the [`Makefile`](Makefile) is located.
1. Run `make install-cert` and wait for pods in the `cert-manager` namespace to be running before moving to step 2.
2. Run `make install && make deploy` and wait until pods in the `registry-operator-system` namespace are running before proceeding to step 3.
3. Run `make test-integration` or `IMG=<your-operator-image> make test-integration` to run the integration tests.

### Submitting Pull Request

Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,7 @@ To see all rules supported by the makefile, run `make help`

## Testing

To run integration tests for the operator, run `make test-integration`.

One of the `oc` or `kubectl` executables must be accessible. If both are present in your path, `oc` will be used, except if you
define the environment variable `K8S_CLI` with the command you prefer to use.

By default, the tests will use the default image for the operator, `quay.io/devfile/registry-operator:next`.

You can use `make <engine>-build` to build your own image, `make <engine>-push` to publish it - Replace `<engine>` with `podman` or `docker`. Then, to use your own image, run:

```
IMG=<your-operator-image> make test-integration
```
Detailed instructions on how to run tests for the Devfile Registry Operator are found in [CONTRIBUTING.md](CONTRIBUTING.md#testing-your-changes).

### Run operator locally
It's possible to run an instance of the operator locally while communicating with a cluster.
Expand Down Expand Up @@ -173,7 +162,7 @@ make run ENABLE_WEBHOOKS=false

## Contributing

Please see our [contributing.md](./CONTRIBUTING.md).
Please see our [CONTRIBUTING.md](./CONTRIBUTING.md).

## Known Issues
- [`make test-integration` times out when running in Minikube](https://github.com/devfile/api/issues/1313)
Expand Down
Loading