Skip to content

Commit

Permalink
Update Testing Documentation (#88)
Browse files Browse the repository at this point in the history
* update documentation for testing the operator

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>

* update pr template for testing changes

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>

* make reference to files consistent cases

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>

* add comment as reminder to update docs

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>

* link test instructions in pr template to contributing

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>

---------

Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
  • Loading branch information
Jdubrick committed Apr 16, 2024
1 parent 89120e9 commit eff2b64
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
14 changes: 13 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ 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**

[Running Unit Tests](https://github.com/devfile/registry-operator/blob/main/CONTRIBUTING.md#unit-tests)

[Running Integration Tests](https://github.com/devfile/registry-operator/blob/main/CONTRIBUTING.md#integration-tests)

<!--
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

0 comments on commit eff2b64

Please sign in to comment.