GoogleContainerTools / GoogleContainerTools/container-structure-test
exit_code not working ?
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm using this yaml for testing my Debian container :
```
commandTests:
- name: "package_locales"
command: "dpkg"
args: ["-l", "locales" ]
exit_code: 0
- name: "package_htop"
command: "dpkg"
args: ["-l", "htop" ]
exit_code: 1
expected_error: "dpkg-query: no packages found matching htop"
```
But :
```
~/tmp/docker docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock:ro -v ${PWD}:/src gcr.io/gcp-runtimes/container-structure-test:latest test --image "debian:jessie" --config /src/test.yaml
==================================
====== Test file: test.yaml ======
==================================
=== RUN: [Command Test: package_locales]
--- PASS
=== RUN: [Command Test: package_htop]
--- FAIL
Error: Test 'package_htop' exited with incorrect error code. Expected: 0, Actual: 1
=== RUN: [Metadata Test]
--- PASS
===============
=== RESULTS ===
===============
Passes: 2
Failures: 1
Total tests: 3
FAIL
```
In my container :
```
root@b58a723b1ec5:/# dpkg -l htop
dpkg-query: no packages found matching htop
root@b58a723b1ec5:/# echo $?
1
```
The test "package_htop" shouldn't break...
Contributor guide
Assessment
This issue has not been assessed yet.