deis / workflow-manager-api

Deis Workflow Manager API
MIT License
5 stars 0 forks source link

ref(*): rewrite SetVersion to use gorm #123

Closed arschles closed 8 years ago

arschles commented 8 years ago

also, since SetVersion is really a create-or-update operation, renamed SetVersion to UpsertVersion

Contributes to #48 Fixes #90

arschles commented 8 years ago

Current status is that tests panic:

--- FAIL: TestVersionRoundTrip (0.00s)
panic: runtime error: cgo argument has Go pointer to Go pointer [recovered]
    panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 32 [running]:
panic(0x485a240, 0xc8204fb080)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
testing.tRunner.func1(0xc8203f3050)
    /usr/local/go/src/testing/testing.go:467 +0x192
panic(0x485a240, 0xc8204fb080)
    /usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3._cgoCheckPointer0(0x47098c0, 0xc8204e32b4, 0x0, 0x0, 0x0, 0x46d0c40)
    ??:0 +0x4d
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*Stmt).bind(0xc8204e33f0, 0xc800000005, 0x46eff00, 0xc8204f34c0, 0x0, 0x0, 0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/sqlite3.go:934 +0x7de
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*Stmt).bindUnnamed(0xc8204e33f0, 0xc8204f86e0, 0x5, 0x5, 0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/sqlite3.go:908 +0x2af
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*Stmt).exec(0xc8204e33f0, 0xc8204f86e0, 0x5, 0x5, 0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/sqlite3.go:867 +0x26f
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*Conn).Exec.func1(0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/sqlite3.go:259 +0x22d
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*Conn).Exec(0xc8204f49f0, 0xc8203a4d90, 0x69, 0xc8204f86e0, 0x5, 0x5, 0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/sqlite3.go:262 +0x309
github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3.(*conn).Exec(0xc8200e8800, 0xc8203a4d90, 0x69, 0xc8204f86e0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/mxk/go-sqlite/sqlite3/driver.go:65 +0x141
database/sql.(*Tx).Exec(0xc8204f8410, 0xc8203a4d90, 0x69, 0xc8203a8f00, 0x5, 0x8, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/database/sql/sql.go:1381 +0x276
github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm.createCallback(0xc8203a8e00)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm/callback_create.go:110 +0xb5b
github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm.(*Scope).callCallbacks(0xc8203a8e00, 0xc820260000, 0x9, 0x10, 0xc82002c010)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm/scope.go:798 +0x68
github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm.(*DB).Create(0xc8204eef00, 0x481eda0, 0xc8204f1200, 0x9)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/vendor/github.com/jinzhu/gorm/main.go:372 +0x7a
github.com/deis/workflow-manager-api/data.upsertVersion(0xc8204eef00, 0x0, 0x0, 0x49609e0, 0xd, 0x4947788, 0x6, 0x4960a70, 0xb, 0x0, ...)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/data/upsert_version.go:19 +0x4bc
github.com/deis/workflow-manager-api/data.UpsertVersion(0xc8204eeb40, 0x49609e0, 0xd, 0x49d7ae0, 0x13, 0x4947788, 0x6, 0x4960a70, 0xb, 0x49bb9a0, ...)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/data/version.go:41 +0x337
github.com/deis/workflow-manager-api/data.TestVersionRoundTrip(0xc8203f3050)
    /Users/aaronschlesinger/gocode/src/github.com/deis/workflow-manager-api/data/version_test.go:36 +0x485
testing.tRunner(0xc8203f3050, 0x4da5ac8)
    /usr/local/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
    /usr/local/go/src/testing/testing.go:582 +0x892
arschles commented 8 years ago

As of https://github.com/deis/workflow-manager-api/pull/123/commits/60d05be41af36eb6ed26df3b50bb12d9caf1026b, tests pass again. Remaining work is to investigate why non-string types can't be in Gorm compatible structs. This is not yet done