fix(handlers_test.go): add unit tests for handlers - #5
Conversation
so it can be used more effectively in tests
also, fill in tests for other endpoints (the tests are still TODO)
also remove the fake cluster, count and version implementations in favor of marshaling/unmarshmaling them to the in-memory DB
it will be written higher on the stack in server_test.go
… a DB it will be called in tests & the server, each with a different underlying database
|
At current, existing tests are compiling and running against an in-memory SQLite DB (using this driver). Currently, the below test failure is occurring: ENG000656:workflow-manager-api aaronschlesinger$ go test -test.v .
=== RUN TestGetVersions
--- SKIP: TestGetVersions (0.00s)
server_test.go:29: TODO
=== RUN TestPostVersions
--- SKIP: TestPostVersions (0.00s)
server_test.go:34: TODO
=== RUN TestGetClusters
2016/03/21 13:15:53 counted 0 records for versions table
2016/03/21 13:15:53 counted 0 records for clusters table
2016/03/21 13:15:53 counted 0 records for clusters_checkins table
--- PASS: TestGetClusters (0.00s)
=== RUN TestGetClusterByID
--- SKIP: TestGetClusterByID (0.00s)
server_test.go:59: TODO
=== RUN TestPostClusters
2016/03/21 13:15:53 counted 0 records for versions table
2016/03/21 13:15:53 counted 0 records for clusters table
2016/03/21 13:15:53 counted 0 records for clusters_checkins table
2016/03/21 13:15:54 sql: Scan error on column index 1: unsupported driver -> Scan pair: []uint8 -> *time.Time
--- FAIL: TestPostClusters (0.00s)
server_test.go:80: Received non-200 response: 500
FAIL
exit status 1
FAIL github.com/deis/workflow-manager-api 0.023sI believe that the error is related to mattn/go-sqlite3#190. I'm working on a fix. |
it acts as a sql.Scanner and driver.Valuer implementation, to be used instead of time.Time in the DB
also, used a json Decoder instead of reading all bytes before decoding
|
looks great |
|
restarted travis, tests failed on fetching deps..... |
| - spew | ||
| - name: github.com/deis/workflow-manager | ||
| version: b37815165204e8a899ece414286fd8e7aba9f6f1 | ||
| repo: git@github.com:deis/workflow-manager |
There was a problem hiding this comment.
In order to placate glide in #8, I had to remove the two lines that you've added here. Might be voodoo, but I see that Travis agrees with me...
There was a problem hiding this comment.
oof, ok thanks. I'll remove
@mboersma says this makes travis happy as well
the vcs entry also makes it barf
|
latest travis failure found this: |
since it can’t be built into the production binary (which turns off cgo, but cgo is required by sqlite), it has to be in a test file
|
@mboersma @jackfrancis I fixed the CGO issue in c9b0b3b (for now - I suspect we'll have to revisit this in the future). |
|
@mboersma can I get a final review when you get a chance? |
fix(handlers_test.go): add unit tests for handlers
This is a work in progress. It currently doesn't even compile...
Ref #3