GoogleContainerTools / GoogleContainerTools/container-structure-test
file contents test regex seems to not be working properly
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
Hello. I have the following 2 tests defined:
```
fileContentTests:
- name: 'hosts check'
path: '/etc/hosts'
expectedContents: [".*127.*"]
commandTests:
- name: "check hosts"
command: "cat"
args: ["/etc/hosts"]
expectedOutput: [".*127.*"]
exitCode: 0
```
In reality, they do the same thing. Make sure the string 127 exists somewhere in the /etc/hosts file. The command test works fine, but the file content test errors out with:
```
=== RUN: File Content Test: hosts check
--- FAIL
duration: 0s
Error: Expected string '.*127.*' not found in file content string ''
```
Am I misusing the regex in the content test check? The fact that the error message seems to indicate that the file content string is empty is suspicious.
I am using version 1.10.
Contributor guide
Assessment
This issue has not been assessed yet.