Skip to content

Commit 3d90748

Browse files
committed
docs(readme): update "Quick testing" section
1 parent 3c4858b commit 3d90748

File tree

1 file changed

+52
-10
lines changed

1 file changed

+52
-10
lines changed

README.md

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,24 +235,37 @@ All the tests are read from an YAML file or a directory (step **1**) and the res
235235

236236
## Quick testing
237237

238+
### Spinning up the environment
239+
238240
- Make sure you have installed [`kind`](https://kind.sigs.k8s.io/) and its prerequisites
239241
- Make sure you have also installed [`just`](https://github.com/casey/just/releases)
240-
- Download the `NetAssert` binary from the [release](https://github.com/controlplaneio/netassert/releases) page
242+
- Download the `NetAssert` binary from the [release](https://github.com/controlplaneio/netassert/releases) page:
243+
244+
```bash
245+
❯ curl -L -o netassert.tar.gz https://github.com/controlplaneio/netassert/releases/download/${VERSION}/netassert_${VERSION}_${OS_ARCH}.tar.gz
246+
247+
❯ tar -xzf netassert.tar.gz -C bin/netassert
248+
```
241249

242-
- If you want to quickly test `NetAssert`, you can make use of the sample test(s) and manifests provided
250+
- Alternatively, you can build `NetAssert` from source:
251+
```bash
252+
❯ just build
253+
```
243254

244-
- You will also need a working kubernetes cluster with ephemeral/debug container support and a CNI that supports Network Policies, you can spin one quickly using the `justfile` included in the repo
255+
- You will also need a working kubernetes cluster with ephemeral/debug container support and a CNI that supports Network Policies, you can spin one quickly using the `justfile` included in the repo:
245256

246257
```bash
247258
❯ just kind-down ; just kind-up
248259
❯ just calico-apply
249260
```
250261

251-
- wait for all the nodes to become ready
262+
- wait for all the nodes to become ready:
252263
```bash
253-
❯ kubectl get nodes
264+
❯ kubectl get nodes -w
254265
```
255266

267+
### Running the sample tests
268+
256269
- In order to use the sample tests, you need to create network policies and kubernetes resources:
257270

258271
```bash
@@ -274,17 +287,43 @@ All the tests are read from an YAML file or a directory (step **1**) and the res
274287

275288
```bash
276289
❯ just netpol-apply
290+
kubectl apply -f ./e2e/manifests/networkpolicies.yaml
291+
networkpolicy.networking.k8s.io/web created
277292
```
278293

279-
- Wait for the workload to become ready
294+
- Wait for the workload to become ready:
280295
```bash
281296
❯ kubectl get pods -A
297+
busybox busybox-6c85d76fdc-r8gtp 1/1 Running 0 76s
298+
echoserver echoserver-64bd7c5dc6-ldwh9 1/1 Running 0 76s
299+
fluentd fluentd-5pp9c 1/1 Running 0 76s
300+
fluentd fluentd-8vvp9 1/1 Running 0 76s
301+
fluentd fluentd-9jblb 1/1 Running 0 76s
302+
fluentd fluentd-jnlql 1/1 Running 0 76s
303+
kube-system calico-kube-controllers-565c89d6df-8mwk9 1/1 Running 0 117s
304+
kube-system calico-node-2sqhw 1/1 Running 0 117s
305+
kube-system calico-node-4sxpn 1/1 Running 0 117s
306+
kube-system calico-node-5gtg7 1/1 Running 0 117s
307+
kube-system calico-node-kxjq8 1/1 Running 0 117s
308+
kube-system coredns-7d764666f9-74xgb 1/1 Running 0 2m29s
309+
kube-system coredns-7d764666f9-jvnr4 1/1 Running 0 2m29s
310+
kube-system etcd-packet-test-control-plane 1/1 Running 0 2m35s
311+
kube-system kube-apiserver-packet-test-control-plane 1/1 Running 0 2m35s
312+
kube-system kube-controller-manager-packet-test-control-plane 1/1 Running 0 2m35s
313+
kube-system kube-proxy-4xjp2 1/1 Running 0 2m27s
314+
kube-system kube-proxy-b28pw 1/1 Running 0 2m29s
315+
kube-system kube-proxy-p9smj 1/1 Running 0 2m27s
316+
kube-system kube-proxy-xb2wq 1/1 Running 0 2m27s
317+
kube-system kube-scheduler-packet-test-control-plane 1/1 Running 0 2m35s
318+
local-path-storage local-path-provisioner-67b8995b4b-jf8lc 1/1 Running 0 2m29s
319+
pod1 pod1 1/1 Running 0 75s
320+
pod2 pod2 1/1 Running 0 76s
321+
web web-0 1/1 Running 0 75s
322+
web web-1 1/1 Running 0 31s
282323
```
283-
- Run the netassert binary pointing it to the test cases, one of the test cases will fail and this is by design:
324+
- Run the netassert binary pointing it to the test cases:
284325

285326
```bash
286-
❯ just build ## from the root of the project
287-
288327
❯ bin/netassert run --input-file ./e2e/manifests/test-cases.yaml
289328

290329
❯ cat results.tap
@@ -301,10 +340,13 @@ ok 8 - test-from-pod1-to-pod2
301340
ok 9 - busybox-deploy-to-fake-host
302341
```
303342

304-
- To see the results when a check fails
343+
- To see the results when a check fails:
305344

306345
```bash
307346
❯ just netpol-rm-apply
347+
kubectl delete -f ./e2e/manifests/networkpolicies.yaml
348+
networkpolicy.networking.k8s.io "web" deleted
349+
308350
❯ bin/netassert run --input-file ./e2e/manifests/test-cases.yaml
309351

310352
❯ cat results.tap

0 commit comments

Comments
 (0)