You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
33
39
34
40
35
41
## Objectives
@@ -123,7 +129,7 @@ Since this project works with BATS, you can use **setup** and **teardown**
123
129
functions to prepare and clean after every test in a file.
124
130
125
131
126
-
## Working with Kubectl or OC commands
132
+
###Working with Kubectl or OC commands
127
133
128
134
If you are working with a native Kubernetes cluster.
129
135
@@ -177,7 +183,7 @@ verify "there are 2 pods named 'nginx'"
177
183
```
178
184
179
185
180
-
## Other Examples
186
+
###Other Examples
181
187
182
188
Examples are available under [the eponym directory](examples/ci).
183
189
It includes...
@@ -278,11 +284,14 @@ verify "there are <number> <resource-type> named '<regular-expression>'"
278
284
*resource-type* is one of the K8s ones (e.g. `pods`, `po`, `services`, `svc`...).
279
285
See [https://kubernetes.io/docs/reference/kubectl/overview/#resource-types](https://kubernetes.io/docs/reference/kubectl/overview/#resource-types) for a complete reference.
280
286
281
-
This simple assertion may fail sometimes.
282
-
As an example, if you count the number of PODs, run your test and then kill the POD, they will still
283
-
be listed, with the TERMINATING state. So, most of the time, you will want to verify the number of instances
284
-
with a given property value. Example: count the number of PODs with a given name pattern and having the `started` status.
285
-
Hence this additional syntax.
287
+
288
+
> :warning: This simple assertion may fail sometimes.
289
+
>
290
+
> As an example, if you count the number of PODs, run your test and then kill the POD, they will still be listed, with the `TERMINATING` state.
291
+
>
292
+
> So, most of the time, you will want to verify the number of instances with a given property value. Example: count the number of PODs with a given name pattern and having the `started` status.
293
+
294
+
Hence this additional syntax (using [next section](#verifying-property-values) documentation to verify additionnal properties):
286
295
287
296
```bash
288
297
# Expecting a given number of instances
@@ -291,14 +300,14 @@ try "at most <number> times every <number>s \
291
300
with '<property-name>' being '<expected-value>'"
292
301
```
293
302
294
-
This is a checking loop.
303
+
:pushpin: This assertion is useful for PODs, whose life cycle changes take time.
304
+
For services, you may directly use the simple count assertions.
305
+
306
+
This is a checking loop.
295
307
It breaks the loop if as soon as the assertion is verified. If it reaches the end of the loop
296
308
without having been verified, an error is thrown. Please, refer to [this section](#property-names) for details
297
309
about the property names.
298
310
299
-
This assertion is useful for PODs, whose life cycle changes take time.
300
-
For services, you may directly use the simple count assertions.
301
-
302
311
303
312
### Verifying Property Values
304
313
@@ -321,13 +330,13 @@ It breaks the loop if as soon as the assertion is verified. If it reaches the en
321
330
without having been verified, an error is thrown. Please, refer to [this section](#property-names) for details
322
331
about the property names.
323
332
324
-
This assertion verifies all the instances have this property value.
325
-
But unlike the assertion type to count resources, you do not verify how many instances have this value. Notice however that **if it finds 0 item verifying the property, the assertion fails**.
333
+
:memo:This assertion verifies _all the instances_ have this property value.
334
+
But unlike the assertion type to [count resources](#counting-resources), you do not verify _how many instances_ have this value. Notice however that **if it finds 0 item verifying the property, the assertion fails**.
326
335
327
336
328
337
### Property Names
329
338
330
-
In all assertions, *property-name*if one of the column names supported by K8s.
339
+
In all assertions, *property-name*is one of the column names supported by K8s.
331
340
See https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns
332
341
You can also find column names by using `kubectl get <resource-type> -o custom-columns=ALL:*`.
0 commit comments