Skip to content

Commit 0385c68

Browse files
committed
README: explain how to use the simple test for executing arbitrary scripts
1 parent a2a2455 commit 0385c68

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,69 @@ podman run --privileged --network=host ghcr.io/ovn-kubernetes/kubernetes-traffic
184184
```
185185
podman run --privileged --network=host ghcr.io/ovn-kubernetes/kubernetes-traffic-flow-tests:latest sh -c 'ktoolbox-netdev | yq -P -C' | less -R
186186
```
187+
188+
## Debugging Tests using Simple Exec Script
189+
190+
When a TFT test fails, it cleans up the broken environment. That can make
191+
debugging cumbersome.
192+
193+
One possible way can be using the "simple" test type with the "--exec"
194+
parameter. The "simple" test type runs
195+
[scripts/simple-tcp-server-client.py](scripts/simple-tcp-server-client.py)
196+
script. Check the `--help` output about the `--exec` options (and
197+
`--exec-insecure`, `--exec-args`, `--exec-arg`). In exec mode, the script
198+
simple does something else. It will download an external script and execute
199+
that instead. That script can do anything and you can tweak it to be useful for
200+
debugging.
201+
202+
There is already a default script
203+
[scripts/simple-exec.sh](scripts/simple-exec.sh). You could take that script as
204+
starting poing and tweak it (or you can use your own script).
205+
206+
If you use `scripts/simple-exec.sh`, then by default it will call it's calling
207+
script `simple-tcp-server-client.py` again, albeit with some steps that might
208+
be useful for debugging. In particular, if the `simple-tcp-server-client.py`
209+
call fails, the script will hang, which allows you to enter the pod and
210+
investigate the problem yourself.
211+
212+
If a non-empty first parameter to `scripts/simple-exec.sh` is provided, then
213+
that is expected to be a URL to download a `simple-tcp-server-client.py` like
214+
script, which is invoked instead of the `simple-tcp-server-client.py` script
215+
from the tft container.
216+
217+
This allows you to run arbitrary code without need to rebuild the tft
218+
container. In a first step, you can pass your own `--exec` script. Either based
219+
on `scripts/simple-exec.sh` or whatever suits you.
220+
221+
If you use the unmodified `scripts/simple-exec.sh`, then by default it will
222+
call back into `scripts/simple-tcp-server-client.py` from inside the container.
223+
This then runs the actual traffic flow test. If you wish, you can also provide
224+
your own patched variant of that latter script, instead of using the one from
225+
the container.
226+
227+
For example, consider the following configuration.
228+
229+
```
230+
--- c/tft-config.yaml
231+
+++ i/tft-config.yaml
232+
@@ -1,21 +1,24 @@
233+
tft:
234+
- name: "Test 1"
235+
namespace: "default"
236+
test_cases: "1"
237+
duration: "30"
238+
+ privileged_pod: true
239+
connections:
240+
- name: "Connection_1"
241+
- type: "iperf-udp"
242+
+ type: "simple"
243+
instances: 1
244+
server:
245+
- name: "$worker"
246+
sriov: "true"
247+
+ args: "--num-clients 0 --exec https://example.com/tft-test/simple-exec.sh --exec-insecure -E https://example.com/tft-test/simple-tcp-server-client.py"
248+
client:
249+
- name: "$worker"
250+
sriov: "true"
251+
+ args: "--exec https://example.com/tft-test/simple-exec.sh --exec-insecure -E https://example.com/tft-test/simple-tcp-server-client.py"
252+
```

0 commit comments

Comments
 (0)