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
@@ -167,6 +168,11 @@ try "at most 5 times every 30s " \
167
168
try at most 5 times every 30s \
168
169
to get svc named "'nginx'" \
169
170
and verify that "'.spec.ports[*].targetPort'" is "'8484'"
171
+
172
+
# Regular expressions can also be used
173
+
try at most 5 times every 30s \
174
+
to get svc named 'nginx' \
175
+
and verify that '.spec.ports[*].targetPort' matches '[[:digit:]]+'
170
176
```
171
177
172
178
If you work with OpenShift and would prefer to use **oc** instead of **kubectl**...
@@ -304,9 +310,7 @@ try "at most <number> times every <number>s \
304
310
For services, you may directly use the simple count assertions.
305
311
306
312
This is a checking loop.
307
-
It breaks the loop if as soon as the assertion is verified. If it reaches the end of the loop
308
-
without having been verified, an error is thrown. Please, refer to [this section](#property-names) for details
309
-
about the property names.
313
+
It breaks the loop if as soon as the assertion is verified. If it reaches the end of the loop without having been verified, an error is thrown. Please, refer to [this section](#property-names) for details about the property names.
310
314
311
315
312
316
### Verifying Property Values
@@ -334,6 +338,65 @@ about the property names.
334
338
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**.
335
339
336
340
341
+
### Using Regular Expressions
342
+
343
+
It is also possible to verify property values against a regular expression.
344
+
This can be used, as an example, to verify values in a JSON array.
345
+
346
+
```bash
347
+
# Verifying a property
348
+
verify "'<property-name>' matches '<regular-experession>' for <resource-type> named '<regular-expression>'"
349
+
350
+
# Finding elements with a matching property
351
+
try "at most <number> times every <number>s \
352
+
to get <resource-type> named '<regular-expression>' \
353
+
and verify that '<property-name>' matches '<regular-experession>'"
354
+
355
+
# Counting elements with a matching property
356
+
try "at most <number> times every <number>s \
357
+
to find <number> <resource-type> named '<regular-expression>' \
358
+
with '<property-name>' matching '<regular-expression>'"
359
+
```
360
+
361
+
The regular expression used for property values relies on
0 commit comments