diff --git a/Gopkg.lock b/Gopkg.lock index 7ad6615..d19d34d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -238,7 +238,7 @@ version = "v2.0.1" [[projects]] - digest = "1:e5655069a773a11061ae33390b10ea68aacc3f3f79c7031a676e38b636edcdfe" + digest = "1:d5381ce402cf3cf88629e1f015622c7c7b10a93356a802ea527059ea8648fe16" name = "github.com/hidevopsio/hiboot" packages = [ "pkg/app", @@ -269,8 +269,8 @@ "pkg/utils/validator", ] pruneopts = "UT" - revision = "941c0052b84a2244213ce34a6412f557553648ae" - version = "v0.6.1" + revision = "aa3c62eedc9613c553fc726692de8292d55ed4e4" + version = "v0.6.2" [[projects]] digest = "1:a3ce4de79566c21e93cb6934797fdaa587ad3fc6a964708ab77babe54ea67188" diff --git a/Gopkg.toml b/Gopkg.toml index 3cf5fb7..5f03717 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -39,7 +39,7 @@ [[constraint]] name = "github.com/hidevopsio/hiboot" - version = "v0.6.1" + version = "v0.6.2" [[constraint]] name = "github.com/stretchr/testify" diff --git a/README.md b/README.md index 61dd167..a132c27 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# hiboot-data-data +# hiboot-data
@@ -19,5 +19,5 @@
-hiboot-data starter, include bolt, etcd, gorm +hiboot data starter, include bolt, etcd, gorm diff --git a/examples/bolt/service/user.go b/examples/bolt/service/user.go index 30f1a80..55f265c 100644 --- a/examples/bolt/service/user.go +++ b/examples/bolt/service/user.go @@ -16,8 +16,8 @@ package service import ( "github.com/hidevopsio/hiboot-data/examples/bolt/entity" - "github.com/hidevopsio/hiboot/pkg/app" "github.com/hidevopsio/hiboot-data/starter/bolt" + "github.com/hidevopsio/hiboot/pkg/app" ) type UserService struct { diff --git a/examples/etcd/controller/user_test.go b/examples/etcd/controller/user_test.go index b87b785..f54cc4e 100644 --- a/examples/etcd/controller/user_test.go +++ b/examples/etcd/controller/user_test.go @@ -17,10 +17,10 @@ package controller import ( "errors" "github.com/hidevopsio/hiboot-data/examples/etcd/entity" + "github.com/hidevopsio/hiboot-data/starter/etcd/fake" "github.com/hidevopsio/hiboot/pkg/app" "github.com/hidevopsio/hiboot/pkg/app/web" "github.com/hidevopsio/hiboot/pkg/log" - "github.com/hidevopsio/hiboot-data/starter/etcd/fake" "github.com/hidevopsio/hiboot/pkg/utils/idgen" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -79,6 +79,17 @@ func TestCrdRequest(t *testing.T) { Gender: 1, } + unknownId, err := idgen.NextString() + assert.Equal(t, nil, err) + svc.On("GetUser", unknownId).Return((*entity.User)(nil), errors.New("not found")) + + t.Run("should return 404 if trying to find a record that does not exist", func(t *testing.T) { + // Then Get User + testApp.Get("/user/id/{id}"). + WithPath("id", unknownId). + Expect().Status(http.StatusNotFound) + }) + t.Run("should add user with POST request", func(t *testing.T) { // First, let's Post User testApp.Post("/user"). @@ -96,17 +107,6 @@ func TestCrdRequest(t *testing.T) { Expect().Status(http.StatusOK) }) - unknownId, err := idgen.NextString() - assert.Equal(t, nil, err) - svc.On("GetUser", unknownId).Return((*entity.User)(nil), errors.New("not found")) - - t.Run("should return 404 if trying to find a record that does not exist", func(t *testing.T) { - // Then Get User - testApp.Get("/user/id/{id}"). - WithPath("id", unknownId). - Expect().Status(http.StatusNotFound) - }) - // assert that the expectations were met svc.AssertExpectations(t) diff --git a/examples/etcd/service/user.go b/examples/etcd/service/user.go index 4bcf2aa..4dbe78b 100644 --- a/examples/etcd/service/user.go +++ b/examples/etcd/service/user.go @@ -20,9 +20,9 @@ import ( "errors" "fmt" "github.com/hidevopsio/hiboot-data/examples/etcd/entity" + "github.com/hidevopsio/hiboot-data/starter/etcd" "github.com/hidevopsio/hiboot/pkg/app" "github.com/hidevopsio/hiboot/pkg/log" - "github.com/hidevopsio/hiboot-data/starter/etcd" "time" ) diff --git a/examples/etcd/service/user_test.go b/examples/etcd/service/user_test.go index ab741d0..6fc8c5d 100644 --- a/examples/etcd/service/user_test.go +++ b/examples/etcd/service/user_test.go @@ -19,8 +19,8 @@ import ( "errors" _ "github.com/erikstmartin/go-testdb" "github.com/hidevopsio/hiboot-data/examples/etcd/entity" - "github.com/hidevopsio/hiboot/pkg/log" "github.com/hidevopsio/hiboot-data/starter/etcd/fake" + "github.com/hidevopsio/hiboot/pkg/log" "github.com/hidevopsio/hiboot/pkg/utils/idgen" "github.com/stretchr/testify/assert" "go.etcd.io/etcd/clientv3" diff --git a/examples/gorm/service/user.go b/examples/gorm/service/user.go index 51be6dd..7234345 100644 --- a/examples/gorm/service/user.go +++ b/examples/gorm/service/user.go @@ -17,8 +17,8 @@ package service import ( "errors" "github.com/hidevopsio/hiboot-data/examples/gorm/entity" - "github.com/hidevopsio/hiboot/pkg/app" "github.com/hidevopsio/hiboot-data/starter/gorm" + "github.com/hidevopsio/hiboot/pkg/app" "github.com/hidevopsio/hiboot/pkg/utils/idgen" ) diff --git a/starter/bolt/test.db b/starter/bolt/test.db index 4ccb801..e26c818 100644 Binary files a/starter/bolt/test.db and b/starter/bolt/test.db differ diff --git a/starter/etcd/autoconfigure_test.go b/starter/etcd/autoconfigure_test.go index 64fbfbf..e1ac401 100644 --- a/starter/etcd/autoconfigure_test.go +++ b/starter/etcd/autoconfigure_test.go @@ -1,8 +1,8 @@ package etcd import ( - "github.com/hidevopsio/hiboot/pkg/log" "github.com/hidevopsio/hiboot-data/starter/etcd/fake" + "github.com/hidevopsio/hiboot/pkg/log" "github.com/stretchr/testify/assert" "go.etcd.io/etcd/clientv3" "testing"