CiscoCloud / distributive

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

Split into packages, introduced logrus #44

Closed langston-barrett closed 9 years ago

langston-barrett commented 9 years ago

Fixes #38, #37. Progress on #11.

noahjl commented 9 years ago

Went through and did some testing using the vagrant box.

There seems to be an issue with the exception returned from the responseMatchesInsecure check. This is true for both mesos.json and marathon.json (only ones that use this check at this time).

Output -

...
goroutine 9 [IO wait]:
net.(*pollDesc).Wait(0xc208010840, 0x72, 0x0, 0x0)
        /usr/lib/golang/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208010840, 0x0, 0x0)
        /usr/lib/golang/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2080107e0, 0xc208030c00, 0x400, 0x400, 0x0, 0x7f05e913ec00, 0xc20802b160)
        /usr/lib/golang/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc20802c070, 0xc208030c00, 0x400, 0x400, 0x0, 0x0, 0x0)
        /usr/lib/golang/src/net/net.go:121 +0xdc
crypto/tls.(*block).readFromUntil(0xc20803d650, 0x7f05e91402f0, 0xc20802c070, 0x5, 0x0, 0x0)
        /usr/lib/golang/src/crypto/tls/conn.go:454 +0xe6
crypto/tls.(*Conn).readRecord(0xc208090000, 0x17, 0x0, 0x0)
        /usr/lib/golang/src/crypto/tls/conn.go:539 +0x2da
crypto/tls.(*Conn).Read(0xc208090000, 0xc208098000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/lib/golang/src/crypto/tls/conn.go:904 +0x166
net/http.noteEOFReader.Read(0x7f05e9140830, 0xc208090000, 0xc208064108, 0xc208098000, 0x1000, 0x1000, 0x6ee2e0, 0x0, 0x0)
        /usr/lib/golang/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc20809ce00, 0xc208098000, 0x1000, 0x1000, 0xc208012000, 0x0, 0x0)
        <autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc20805cb40)
        /usr/lib/golang/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).Peek(0xc20805cb40, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/golang/src/bufio/bufio.go:132 +0xf0
net/http.(*persistConn).readLoop(0xc2080640b0)
        /usr/lib/golang/src/net/http/transport.go:842 +0xa4
created by net/http.(*Transport).dialConn
        /usr/lib/golang/src/net/http/transport.go:660 +0xc9f

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/lib/golang/src/runtime/asm_amd64.s:2232 +0x1

goroutine 10 [select]:
net/http.(*persistConn).writeLoop(0xc2080640b0)
        /usr/lib/golang/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
        /usr/lib/golang/src/net/http/transport.go:661 +0xcbc

Check using curl -

bash-4.2# curl -k https://localhost:5050
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>

Meso.json snippet -

        {
           "Name": "mesos UI",
           "Check": "responseMatchesInsecure",
           "Parameters":["https://localhost:5050","401"]
        },
noahjl commented 9 years ago

It looks like filesystem's 'directory' check is not returning a happy exception: Check -

        {
            "Name": "distributive configuration directory",
            "Check": "directory",
            "Parameters": ["/etc/distributive.d/"]
        }

Error since this directory does not exist -

-bash-4.2# distributive-new -log-level="info" -a "" -f common.json
INFO[0000] Creating checklist(s)...
INFO[0000] Running checklist: common health check
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x30 pc=0x487920]

goroutine 1 [running]:
github.com/CiscoCloud/distributive/workers.func·002(0xc20801eaa0, 0x14, 0x0, 0x0, 0x0)
        /home/vagrant/go/src/github.com/CiscoCloud/distributive/workers/filesystem.go:61 +0x70
github.com/CiscoCloud/distributive/workers.isType(0x7a6930, 0x9, 0x830a40, 0xc20801eaa0, 0x14, 0x10, 0x0, 0x0)
        /home/vagrant/go/src/github.com/CiscoCloud/distributive/workers/filesystem.go:31 +0x58
github.com/CiscoCloud/distributive/workers.directory(0xc20802cb00, 0x1, 0x4, 0x1, 0x0, 0x0)
        /home/vagrant/go/src/github.com/CiscoCloud/distributive/workers/filesystem.go:66 +0x6e
main.runChecks(0xc20801e820, 0x13, 0xc20803cfc0, 0x28, 0xc208084000, 0x9, 0x10, 0xc208099500, 0x7, 0x8, ...)
        /home/vagrant/distributive/main.go:288 +0x46d
main.main()
        /home/vagrant/distributive/main.go:338 +0x4ae

Using feature/logrus branch on vagrant box.

langston-barrett commented 9 years ago

Same fix as the file check. Should've caught that then. Fixed!