Open myroslavrozum opened 4 years ago
I believe I found an answer to my question, and the answer is "yes, in general but...". You can pass pod's name as a target to read_pod_logs: https://github.com/chaostoolkit/chaostoolkit-lib/blob/master/chaoslib/hypothesis.py#L302 So just adding:
{
"name": "read-microservices-logs",
"type": "probe",
"tolerance": {
"type": "regex,",
"pattern": "UP"
"target": ui-849869f549-gyhbc
},
"provider": {
"func": "read_pod_logs",
"arguments": {
"label_selector": "app.kubernetes.io/name=ui",
"ns": "dev",
"container_name": "ui"
},
"module": "chaosk8s.probes",
"type": "python"
}
}
worked but it's not really useful since pod names are dynamic. Should'n it be replaced with container's name instead?
Hello, I wanted to check logs returned by read_pod_logs with regex but getting the error: "return rx.search(value) is not None". My probe was similar to:
But got an error:
File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/chaoslib/hypothesis.py", line 304, in _ return rx.search(value) is not None TypeError: expected string or bytes-like object
Can it be caused by function returning dictionary instead of string?