Closed FlxPeters closed 4 years ago
Currently goss doesn't support multiline regex, it scans a file one-line at a time so it doesn't have to load whole files into memory.
If this is an important feature for you, we can mark this as an "enhancement" and work through the details.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
For what it's worth, this will be part of goss v0.4.0:
cat /tmp/haproxy.cfg
frontend haproxy_frontend_redirect
bind *:80
redirect scheme https if !{ ssl_fc }
file:
/tmp/haproxy.cfg:
exists: true
contains:
match-regexp: 'frontend haproxy_frontend_redirect\n\s*bind\s*\*:80'
$ goss v --format documentation
File: /tmp/haproxy.cfg: exists: matches expectation: true
File: /tmp/haproxy.cfg: contains: matches expectation: {"match-regexp":"frontend haproxy_frontend_redirect\\n\\s*bind\\s*\\*:80"}
Total Duration: 0.000s
Count: 2, Failed: 0, Skipped: 0
Hi,
i have an issue with the file contains check. I want to check if a HAProxy frontend is available. The config files contains the following lines:
My goss.yaml contains ist the following check:
goss validate gives me the return, that my regex does not match the content of the file.
The regex is valid. You can find an example here: https://regex101.com/r/Gp2Ray/1
Is it a bug or how is a multiline regex possible? As you can see, it is important, that this rows are directly connmected without any other text betweeen.