https://github.com/kubeshop/testkube-executor-tracetest
TestKube executor for Tracetest
https://github.com/kubeshop/testkube-executor-tracetest
Last synced: 21 days ago
JSON representation
TestKube executor for Tracetest
- Host: GitHub
- URL: https://github.com/kubeshop/testkube-executor-tracetest
- Owner: kubeshop
- License: mit
- Created: 2023-02-13T20:13:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-09T22:05:00.000Z (over 1 year ago)
- Last Synced: 2025-03-22T19:42:29.864Z (about 1 month ago)
- Language: Go
- Size: 168 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README

# Welcome to TestKube Tracetest Executor
TestKube Tracetest Executor is a test executor to run [Tracetest](https://tracetest.io/) tests with [TestKube](https://testkube.io).
# Running Tracetest with Testkube
[Tracetest](https://tracetest.io/) is a testing tool based on [OpenTelemetry](https://opentelemetry.io/) that permits you to test your distributed application. It allows you to use the trace data generated by your OpenTelemetry tools to check and assert if your application has the desired behavior defined by your test definitions.
[Testkube](https://testkube.io/) is a Kubernetes-native testing framework for Testers and Developers that allows you to automate the executions of your existing testing tools inside your Kubernetes cluster, removing all the complexity from your CI/CD/GitOps pipelines.
By using the [Testkube Tracetest Executor](https://github.com/kubeshop/testkube-executor-tracetest) you can unlock Testkube's capacity in conjunction with Tracetest, and leverage the work you have already done to instrument your services.
## Quickstart
Here we will show how to use Testkube alongside Tracetest to run your tests in a Kubernetes cluster.
### Prerequisites
In your Kubernetes cluster you should have:
1. `Testkube`: Use HELM or the Testkube CLI to [install](https://kubeshop.github.io/testkube/installing) Testkube Server components in your cluster.
2. `Tracetest`: You need a running instance of [Tracetest](https://docs.tracetest.io/getting-started/installation/) or [Tracetest Core](https://docs.tracetest.io/core/getting-started/installation/) which is going to be executing your assertions. To do so you can follow the instructions defined in the Tracetest [documentation](https://docs.tracetest.io/getting-started/overview).
3. `OpenTelemetry Instrumented Service`: In order to generate traces and spans, the service under test must support the basics for [propagation](https://opentelemetry.io/docs/reference/specification/context/api-propagators/) through HTTP requests, and also store traces and spans into a Data Store Backend (Jaeger, Grafana Tempo, OpenSearch, etc) or use the [OpenTelemetry Collector](https://docs.tracetest.io/configuration/overview#using-tracetest-without-a-trace-data-store).On your machine you should have:
1. `Kubectl` [installed](https://kubernetes.io/docs/tasks/tools/)
2. `Testkube CLI` [installed](https://kubeshop.github.io/testkube/installing#1-installing-the-testkube-cli)With everything set up, we will start configuring Testkube and Tracetest.
### 1. Deploy the Tracetest Executor
Testkube works with the concept of [Executors](https://kubeshop.github.io/testkube/test-types/executor-custom). An Executor is a wrapper around a testing framework (Tracetest in this case) in the form of a Docker container and runs as a Kubernetes job. To start you need to register and deploy the Tracetest executor in your cluster using the Testkube CLI:
```bash
kubectl testkube create executor --image kubeshop/testkube-executor-tracetest:latest --types "tracetest/test" --name tracetest-executor
```### 2. Create your test
Now you need a Tracetest test. Have a look at the [Tracetest documentation](https://docs.tracetest.io/cli/creating-tests) for details on writing tests. Here is a simple test definition example:
```yaml
type: Test
spec:
id: R5NITR14g
name: Pokeshop - List
description: Get a Pokemon
trigger:
type: http
httpRequest:
url: http://demo-pokemon-api.demo/pokemon?take=20&skip=0
method: GET
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http"]
assertions:
- attr:http.method = "GET"
- selector: span[tracetest.span.type="database"]
assertions:
- attr:db.name = "pokeshop"
```Execute the following command to create the test executor object in Testkube. Do not forget to provide the path to your Tracetest definition file using the `--file` argument, and also the Tracetest Server endpoint using the `TRACETEST_ENDPOINT` `--variable`:
```bash
kubectl testkube create test --file my/file/location.yaml --type "tracetest/test" --name pokeshop-tracetest-test --variable TRACETEST_ENDPOINT=http://tracetest
```### 3. Run your test
Finally, to see the integration working, you only need to run the test by executing the following command:
```bash
kubectl testkube run test --watch pokeshop-tracetest-test
```# Architecture
The following is high level sequence diagram on how Testkube and Tracetest interact with the different pieces of the system:
```mermaid
sequenceDiagram
testkube client->>+testkube: Trigger Testkube test run
testkube->>+executor CRDs: Get executor details
executor CRDs-->>-testkube: Send details
testkube->>+tracetest executor job: Schedules execution
tracetest executor job->>+tracetest executor job: Configure Tracetest CLI
tracetest executor job->>+tracetest server: Executes the Tracetest test run
tracetest server->>+instrumented service: Trigger request
instrumented service-->>-tracetest server: Get response
instrumented service->>+data store: Send telemetry data
tracetest server->>+data store: Fetch trace
data store-->>-tracetest server: Get trace
tracetest server->>+tracetest server: Run assertions
tracetest server-->>-tracetest executor job: Return test run results
tracetest executor job-->>-testkube: Return test run results
testkube-->>-testkube client: Send details
```# Issues and enchancements
Please follow the main [TestKube repository](https://github.com/kubeshop/testkube) for reporting any [issues](https://github.com/kubeshop/testkube/issues) or [discussions](https://github.com/kubeshop/testkube/discussions)
# Testkube
For more info go to [main testkube repo](https://github.com/kubeshop/testkube)
 [](https://github.com/kubeshop/testkube/tags?label=Downloads) 
  

#### [Documentation](https://kubeshop.github.io/testkube) | [Discord](https://discord.gg/hfq44wtR6Q)
# Tracetest
For more info go to [main tracetest repo](https://github.com/kubeshop/tracetest)

#### [Documentation](https://docs.tracetest.io/) | [Discord](https://discord.gg/6zupCZFQbe)