CiscoCloud / distributive

Unit testing for the cloud
Apache License 2.0
147 stars 20 forks source link

Docker run and go test failing #101

Closed nyanshak closed 8 years ago

nyanshak commented 8 years ago

Doing a docker run on the included Dockerfile shows failing tests. The same occurs upon attempting go test within /bin/sh of the docker container.

Expected: Passing tests? Actual: (docker build and run)

time="2015-10-19T21:09:24Z" level=info msg="Creating checklist(s)..." path="/gopath/src/github.com/CiscoCloud/distributive/samples/filesystem.json" type=file
time="2015-10-19T21:09:24Z" level=info msg="Running checklist File"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist Directory"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist Symlink"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist checksum"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist checksum"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist FileMatches"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist Permissions"
time="2015-10-19T21:09:24Z" level=info msg="Running checklist DiskUsage"
time="2015-10-19T21:09:24Z" level=info msg="Report from checklist" checklist="Filesystem checks" report="↴\nTotal: 8\nPassed: 2\nFailed: 6\nOther: 0\nNo such file or directory: /swapfile\nNo such file or directory: /home/lb/Dropbox/workspace/www\nChecksums do not match for file: /proc/cpuinfo:\n\tSpecified: d41d8cd98f00b204e9800998ecf8427e\n\tActual: 7893716ba2111356aef27c7f6e53a802\nChecksums do not match for file: /proc/cpuinfo:\n\tSpecified: da39a3ee5e6b4b0d3255bfef95601890afd80709\n\tActual: 732d25bb0decd00b5d5fd52497ea34e9fdbed427\nFile does not match regexp:\n\tFile: /proc/net/tcp\n\tRegexp: \\d{8}\nFile did not have permissions: -rw-rw-rw-"

(docker run -it $img /bin/sh, followed by go test)

/gopath/src/github.com/CiscoCloud/distributive # go test
FATA[0000] Couldn't read file/dir                        error=stat /bin/bash: no such file or directory path=/bin/bash
exit status 1
FAIL    github.com/CiscoCloud/distributive  0.003s

I believe this stems from specific files and / or executables missing from the gliderlabs/alpine:3.2 image that are expected by the tests in this package. For example bash is expected to exist as well as certain other mountpoints (/opt). I haven't done a full dive into this yet, but if this is something that you'd like to pursue, I can probably submit a PR in the next few days.

langston-barrett commented 8 years ago

Yeah, sorry that's confusing behavior! It does run a few tests that don't pass in a Docker container. As noted in the comment in the Dockerfile, its not really suited to running in a container in the first place. I'll try and make some tests that pass in that container since that behavior would make more sense.

nyanshak commented 8 years ago

Would that entail simply removing tests or making the existing tests pass? If you need help with this, I can submit a pull request.

langston-barrett commented 8 years ago

@nyanshak That would be spectacular! Yeah, if you just want to create a new file like samples/alpine-docker.json with tests that will pass in that container, that'd be perfect. The files that are currently in samples are just examples, not really meant to necessarily pass.

langston-barrett commented 8 years ago

Fixed in 37277db