E2E Test: External Solution Integration
Overview
This test verifies if the user can connect an external application to Kyma and interact with its APIs and events using lambda functions. The test setup mimics a real-world scenario. This means no internal APIs are used and every request sent from the test to the cluster is routed through the ingress-gateway. Additionally, the test application is connected using client certificates, just like an application in a production environment would be connected.
Test scenario
When you run the test, these actions are performed in the order listed:
- Create an Application.
- Create an ApplicationMapping CR for the created application in the
e2e-test
Namespace.
- Deploy a lambda function in the
e2e-test
Namespace.
- Start a test service in the
e2e-test
Namespace. The lambda function calls it when it receives an event.
- Connect an application through the Application Gateway with client certificates.
- Register a test service in the Application Registry. The service exposes an event API.
- Create a ServiceInstance for the registered ServiceClass.
- Create a ServiceBinding for the ServiceInstance.
- Create ServiceBindingUsage CR of that binding for the deployed lambda function.
- Create a Subscription for lambda function, so it is subscribed to the events exposed by the application.
- Send an event to the Application Gateway.
- Verify if the call from the lambda reached the test service.
Compass end-to-end scenario
This scenario uses Compass to register an Application and its APIs and Events.
Steps
The test performs the following actions:
- Adds the tested Runtime to the
DEFAULT
scenario in Compass.
- Registers an Application with API and Event in Compass.
- Creates the ApplicationMapping CR for the created Application in the
compass-e2e-test
Namespace.
- Deploys a lambda function in the
compass-e2e-test
Namespace.
- Starts a test service in the
compass-e2e-test
Namespace. The lambda function calls it when it receives an event.
- Connects the Application through the Application Gateway with client certificates.
- Creates ServiceInstances for ServiceClasses registered by Compass Runtime Agent (one for API and one for Event services).
- Creates a ServiceBinding for the API ServiceInstance.
- Creates the ServiceBindingUsage CR of that binding for the deployed lambda function.
- Creates a Subscription for the lambda function, so that it is subscribed to the events exposed by the Application.
- Sends an event to the Application Gateway.
- Verifies if the call from the lambda reached the test service.
Environment variables
The test requires the following environment variables:
Environment variable name |
Description |
DEX_SECRET_NAME |
Name of the Kubernetes Secret which stores Dex user credentials |
DEX_SECRET_NAMESPACE |
Namespace of the Kubernetes Secret which stores Dex user credentials |
DIRECTOR_URL |
Compass Director URL. The URL should not end with /graphql . |
TENANT |
Compass Tenant ID |
RUNTIME_ID |
Compass Runtime ID |
DOMAIN |
Cluster domain |
Test scenario (with Event Mesh Alpha)
When you run the test, these actions are performed in the order listed:
- Create an Application.
- Create an ApplicationMapping CR for the created application in the
e2e-mesh-ns
Namespace.
- Deploy a lambda function in the
e2e-mesh-ns
Namespace.
- Start a test service in the
e2e-mesh-ns
Namespace. The lambda function calls it when it receives an event.
- Connect an application through the Application Gateway with client certificates.
- Register a test service in the Application Registry. The service exposes an event API.
- Create a ServiceInstance for the registered ServiceClass.
- Create a ServiceBinding for the ServiceInstance.
- Create ServiceBindingUsage CR of that binding for the deployed lambda function.
- Create a Knative Trigger for lambda function, so it is subscribed to the events exposed by the application.
- Send a Cloud event to the Application Gateway at
/events
path.
- Verify if the call from the lambda reached the test service.
Run the test locally
Run against Kyma cluster on Minikube
- Add an entry to your system's
/etc/hosts
that maps the counter-service.kyma.local
to 127.0.0.1
- Run the test using the following command:
go run ./cmd/runner e2e
Run against Kyma cluster in the cloud
Run the test using the following command:
go run ./cmd/runner e2e --domain {CLUSTER_DOMAIN}
TIP: If you are running the test on a cluster with invalid or self-signed SSL certificates, use the --skipSSLVerify
flag.