Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(handlers_test.go): add unit tests for handlers #5

Merged
merged 30 commits into from
Mar 22, 2016

Conversation

arschles
Copy link
Member

This is a work in progress. It currently doesn't even compile...
Ref #3

@arschles
Copy link
Member Author

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.023s

I believe that the error is related to mattn/go-sqlite3#190. I'm working on a fix.

Aaron Schlesinger added 3 commits March 21, 2016 14:12
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
@jackfrancis
Copy link
Member

looks great

@arschles
Copy link
Member Author

restarted travis, tests failed on fetching deps.....

@@ -39,6 +41,8 @@ imports:
- spew
- name: github.com/deis/workflow-manager
version: b37815165204e8a899ece414286fd8e7aba9f6f1
repo: git@github.com:deis/workflow-manager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm voodoo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, ok thanks. I'll remove

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c9f8f75

Aaron Schlesinger added 2 commits March 21, 2016 15:23
@mboersma says this makes travis happy as well
the vcs entry also makes it barf
@arschles
Copy link
Member Author

latest travis failure found this: data/mem_db.go:7:2: C source files not allowed when not using cgo or SWIG: sqlite3.c, which will make it problematic to use sqlite for testing. I'll be looking for an alternative (it'll likely need to be pure Go)

Aaron Schlesinger added 2 commits March 21, 2016 15:55
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
@arschles
Copy link
Member Author

@mboersma @jackfrancis I fixed the CGO issue in c9b0b3b (for now - I suspect we'll have to revisit this in the future).

@arschles
Copy link
Member Author

@mboersma can I get a final review when you get a chance?

arschles added a commit that referenced this pull request Mar 22, 2016
fix(handlers_test.go): add unit tests for handlers
@arschles arschles merged commit bfa7016 into deis:master Mar 22, 2016
@arschles arschles deleted the unit-tests branch March 22, 2016 16:26
@arschles arschles mentioned this pull request Mar 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants