> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/npp/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/npp/latest/guides/run-tests.md).

# Run a test

Tests run once and store the result in the CR status. NPP provides four test types:

- `PingTest` — one-shot ICMP ping test
- `DownloadTest` — one-shot download throughput test
- `MTRTest` — one-shot MTR traceroute test
- `SpeedtestTest` — one-shot [Ookla speedtest](https://www.speedtest.net/)

## Prerequisites

- [NPP installed](https://docs.cennso.com/components/npp/latest/installation.md) on the Core Cluster
- `kubectl`

## Steps

1. Create a namespace for your probe:

   ```bash
   kubectl create namespace {NAMESPACE}
   ```

2. Deploy the target application:

   ```bash
   kubectl create deployment nginx --image=nginx --namespace {NAMESPACE}
   ```

3. Create a CR manifest for your test. See the **Technical Reference** for a configuration example:

   - [PingTest](https://docs.cennso.com/components/npp/latest/technical-reference/npp.cennso.com_pingtests.md#configuration-example)
   - [DownloadTest](https://docs.cennso.com/components/npp/latest/technical-reference/npp.cennso.com_downloadtests.md#configuration-example)
   - [MTRTest](https://docs.cennso.com/components/npp/latest/technical-reference/npp.cennso.com_mtrtests.md#configuration-example)
   - [SpeedtestTest](https://docs.cennso.com/components/npp/latest/technical-reference/npp.cennso.com_speedtesttests.md#configuration-example)

4. Apply the CR to the cluster:

   ```bash
   kubectl apply --namespace {NAMESPACE} -f {FILENAME}.yaml
   ```

## Verification

Run the following command to check the status of your tests:

```bash
kubectl get \
  pingtests.npp.cennso.com,\
  downloadtests.npp.cennso.com,\
  mtrtests.npp.cennso.com,\
  speedtesttests.npp.cennso.com \
  --namespace {NAMESPACE}
```

When a test is complete, the output shows `True` in the `CONFIGURED`, `DEPLOYED`, and `READY` columns:

```text
NAME                    CONFIGURED   DEPLOYED   READY   AGE
ping-test-sample        True         True       True    1m
download-test-sample    True         True       True    1m
mtr-test-sample         True         True       True    1m
speedtest-test-sample   True         True       True    1m
```

## Read results

Test results are stored in the `status.output` field of the CR in Prometheus metrics format.

For a `PingTest`:

```bash
kubectl get pingtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE} --output=jsonpath={@.status.output}
```

For a `DownloadTest`:

```bash
kubectl get downloadtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE} --output=jsonpath={@.status.output}
```

For an `MTRTest`:

```bash
kubectl get mtrtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE} --output=jsonpath={@.status.output}
```

For a `SpeedtestTest`:

```bash
kubectl get speedtesttests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE} --output=jsonpath={@.status.output}
```

## Re-run a test

To run a test again, delete the CR and reapply the manifest:

For a `PingTest`:

```bash
kubectl delete pingtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE}
kubectl apply --namespace {NAMESPACE} -f {FILENAME}.yaml
```

For a `DownloadTest`:

```bash
kubectl delete downloadtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE}
kubectl apply --namespace {NAMESPACE} -f {FILENAME}.yaml
```

For an `MTRTest`:

```bash
kubectl delete mtrtests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE}
kubectl apply --namespace {NAMESPACE} -f {FILENAME}.yaml
```

For a `SpeedtestTest`:

```bash
kubectl delete speedtesttests.npp.cennso.com {TEST_NAME} --namespace {NAMESPACE}
kubectl apply --namespace {NAMESPACE} -f {FILENAME}.yaml
```
