Closed shan100github closed 4 years ago
As you've noticed string matching isn't an exact match, if you need this you'll have to use regex and use ^ and $ to signal start/end of line, ex: '/^some_regex$/'
In your case:
file:
/var/spool/cron/temp:
exists: true
filetype: file
contains:
- '/^\*/5 \* \* \* \* /usr/local/tmp/tmp1.sh exec > /dev/null$/'
Thanks for your quick reply & it worked.
Awesome! :)
I would like to know how we can do the exact matching of content through goss. file content:
*/5 * * * * /usr/local/tmp/tmp1.sh exec > /dev/null 2>&1
currently, I am trying to test with the following goss.yaml
I am expecting this to fail because goss.yaml doesn't have
2>&1
. If it's not possible through file checking, how we can achieve it.I have gone through templates & pattern matching but finding difficult to understand it. Sorry for the noise, looking forward to get some guidance.