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

Added documentation for e2e tests #97

Merged
merged 9 commits into from
Sep 14, 2023
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
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"
50 changes: 50 additions & 0 deletions hack/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Eventing End-to-End Tests
Tests the end-to-end flow for eventing-manager.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved

## Overview

This test covers the end-to-end flow for Eventing. It is divided in three parts:
1. `setup` - prepares an Eventing CR and verifies that all the required resources are being provisioned by the eventing-manager.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
2. `eventing` - prepares Subscription CR(s) and tests the end-to-end delivery of events for different event types.
3. `cleanup` - removes the test resources and namespaces from the cluster.

NHingerl marked this conversation as resolved.
Show resolved Hide resolved
## Usage

### Pre-requisites
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved

- [Go](https://go.dev/)
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
- Access to Kubernetes cluster ([k3d](https://k3d.io/) / k8s)
- Eventing-manager deployed to the cluster without any Eventing CR.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
- For EventMesh backend, the following secrets should exist in the cluster:
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
- 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`.

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the beginning of each line of the code block, add 3 blank spaces for proper indentation below the list item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

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. Run the following command to set up the environment variables in your system:
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
```bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the beginning of each line of the code block, add 3 blank spaces for proper indentation below the list item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

export $(xargs < .env)
```

3. Run the following make target to run the whole end-to-end test suite.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
```bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the beginning of each line of the code block, add 3 blank spaces for proper indentation below the list item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added!

make e2e
```

### Make targets
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved

NHingerl marked this conversation as resolved.
Show resolved Hide resolved
- `make e2e-setup` - creates an Eventing CR and verifies that all the required resources are being 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.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
- `make e2e-eventing-setup` - prepares Subscription CR(s) and deploys a subscriber to be used in subscriptions as a sink. It will not update the Subscription CR(s) if they already exists.
mfaizanse marked this conversation as resolved.
Show resolved Hide resolved
- `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.