Skip to content

Commit

Permalink
Added documentation for e2e tests (#97)
Browse files Browse the repository at this point in the history
* Added documentation for e2e tests

* updated doc

* updated doc

* updated doc

* Apply suggestions from code review

Co-authored-by: Nina Hingerl <[email protected]>

* updated doc

* updated doc

* Update hack/e2e/README.md

Co-authored-by: Nina Hingerl <[email protected]>

* Apply suggestions from code review

Co-authored-by: Nina Hingerl <[email protected]>

---------

Co-authored-by: Nina Hingerl <[email protected]>
  • Loading branch information
mfaizanse and NHingerl authored Sep 14, 2023
1 parent 343a348 commit 244deee
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ kubectl get pods -n eventing-manager-system
kubectl get -n kyma-system eventing
```

## End-to-End Tests

See [hack/e2e/README.md](hack/e2e/README.md)

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)
Expand Down
4 changes: 4 additions & 0 deletions hack/e2e/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
KUBECONFIG=
BACKEND_TYPE=NATS
MANAGER_IMAGE=
EVENTMESH_NAMESPACE="/default/sap.kyma/tunas-develop"
51 changes: 51 additions & 0 deletions hack/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Eventing End-to-End Tests
Tests the end-to-end flow for Eventing manager.

## Overview

This test covers the end-to-end flow for Eventing. It tests the creation of an Eventing CR and verifies that all the required resources are provisioned by the Eventing manager. It also tests the end-to-end delivery of events for different event types.

## Usage

### Prerequisites

- [Go](https://go.dev/)
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
- Access to Kubernetes cluster (k8s)
- Eventing manager deployed to the cluster without any Eventing CR.
- For EventMesh backend, the following secrets must exist in the cluster:
- Event Mesh credentials secret by name: `eventing-backend` in namespace: `kyma-system`.
- OAuth client secret by name: `eventing-webhook-auth` in namespace: `kyma-system`.

### How to run end-to-end tests

1. Prepare the `.env` file based on the `.env.template`.

```
KUBECONFIG= # Kubernetes cluster kubeconfig file path
BACKEND_TYPE=NATS # NATS or EventMesh
MANAGER_IMAGE= # [Optional] Container image of eventing-manager
EVENTMESH_NAMESPACE= # [Optional] Default is: "/default/sap.kyma/tunas-develop"
```

2. To set up the environment variables in your system, run:

```bash
export $(xargs < .env)
```

3. To run the whole end-to-end test suite, run:

```bash
make e2e
```

### Run a single test phase

If you want to run only a single test phase, use the following make targets:

- `make e2e-setup` - creates an Eventing CR and verifies that all the required resources are provisioned by the eventing-manager. If an Eventing CR already exists in the cluster, then it will only update the CR if the `spec.backend.type` is different from the backend configured for tests.
- `make e2e-eventing-setup` - prepares Subscription CR(s) and deploys a subscriber to be used in subscriptions as a sink. It does not update the Subscription CR(s) if they already exist.
- `make e2e-eventing` - tests the end-to-end delivery of events for different event types.
- `make e2e-eventing-cleanup` - removes the subscriber and the Subscription CR(s) from the cluster.
- `make e2e-cleanup` - removes all the test resources and namespaces from the cluster.

0 comments on commit 244deee

Please sign in to comment.