flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.78k stars 366 forks source link

Unit test issues #96

Closed 0xmichalis closed 6 years ago

0xmichalis commented 6 years ago

A couple of issues/observations I stumbled across when I run make test:

  1. It was surprising to get a failure but seeing no output. I had to dig around the code in order to figure out what was failing and realize that the output is redirected to a different directory in the repo. Is there any reason for doing that?
# Running tests only where they failed
$ pwd
/home/mkargaki/guerilla/src/github.com/flashmob/go-guerrilla/cmd/guerrillad
$ go test
exit status 1
FAIL    github.com/flashmob/go-guerrilla/cmd/guerrillad 0.143s
$ cat ../../tests/testlog 
time="2017-12-26T04:04:02+01:00" level=info msg="guerrillad unknown" 
time="2017-12-26T04:04:02+01:00" level=debug msg="Build Time: unknown" 
time="2017-12-26T04:04:02+01:00" level=debug msg="Commit:     unknown" 
time="2017-12-26T04:04:02+01:00" level=fatal msg="Combined max clients for all servers (2000) is greater than open file limit (1024). Please increase your open file limit or decrease max clients." 
  1. I noticed that errors for things like file reads/writes are ignored in a lot of places. Combined with the lack of logging, any failures from those calls will be hard to debug. FWIW, I didn't need to fix any code to see my error. I had to dig around for the log because of 1.

    time="2017-12-26T04:04:02+01:00" level=fatal msg="Combined max clients for all servers (2000) is greater than open file limit (1024). Please increase your open file limit or decrease max clients." 
  2. pid files used as test artifacts are not cleaned up correctly in case of a test failure. Is the intention here to keep them around to inspect failures?