Skip to content

Commit

Permalink
make check happy
Browse files Browse the repository at this point in the history
  • Loading branch information
weekface committed Dec 18, 2018
1 parent a84fc47 commit 4d191cc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 40 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dnephin/govet v0.0.0-20171012192244-4a96d43e39d3 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect
github.com/emicklei/go-restful v2.8.0+incompatible
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnephin/govet v0.0.0-20171012192244-4a96d43e39d3/go.mod h1:pPTX0MEEoAnfbrAGFj4nSVNhl6YbugRj6eardUZdtGo=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o=
Expand Down
16 changes: 8 additions & 8 deletions pkg/manager/member/tidb_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ func TestTiDBMemberManagerSyncCreate(t *testing.T) {
name: "normal",
prepare: nil,
errWhenCreateStatefulSet: false,
err: false,
setCreated: true,
err: false,
setCreated: true,
},
{
name: "tikv is not avaliable",
prepare: func(tc *v1alpha1.TidbCluster) {
tc.Status.TiKV.Stores = map[string]v1alpha1.TiKVStore{}
},
errWhenCreateStatefulSet: false,
err: true,
setCreated: false,
err: true,
setCreated: false,
},
{
name: "error when create statefulset",
prepare: nil,
errWhenCreateStatefulSet: true,
err: true,
setCreated: false,
err: true,
setCreated: false,
},
}

Expand Down Expand Up @@ -190,7 +190,7 @@ func TestTiDBMemberManagerSyncUpdate(t *testing.T) {
tc.Status.TiKV.Phase = v1alpha1.NormalPhase
},
errWhenUpdateStatefulSet: false,
err: false,
err: false,
expectStatefulSetFn: func(g *GomegaWithT, set *apps.StatefulSet, err error) {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(int(*set.Spec.Replicas)).To(Equal(5))
Expand All @@ -204,7 +204,7 @@ func TestTiDBMemberManagerSyncUpdate(t *testing.T) {
tc.Status.TiKV.Phase = v1alpha1.NormalPhase
},
errWhenUpdateStatefulSet: true,
err: true,
err: true,
expectStatefulSetFn: func(g *GomegaWithT, set *apps.StatefulSet, err error) {
g.Expect(err).NotTo(HaveOccurred())
},
Expand Down
64 changes: 32 additions & 32 deletions pkg/manager/member/tikv_member_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ func TestTiKVMemberManagerSyncCreate(t *testing.T) {
prepare: nil,
errWhenCreateStatefulSet: false,
errWhenCreateTiKVPeerService: false,
err: false,
tikvPeerSvcCreated: true,
setCreated: true,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
err: false,
tikvPeerSvcCreated: true,
setCreated: true,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
},
{
name: "pd is not avaliable",
Expand All @@ -140,11 +140,11 @@ func TestTiKVMemberManagerSyncCreate(t *testing.T) {
},
errWhenCreateStatefulSet: false,
errWhenCreateTiKVPeerService: false,
err: true,
tikvPeerSvcCreated: false,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
err: true,
tikvPeerSvcCreated: false,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
},
{
name: "tidbcluster's storage format is wrong",
Expand All @@ -153,33 +153,33 @@ func TestTiKVMemberManagerSyncCreate(t *testing.T) {
},
errWhenCreateStatefulSet: false,
errWhenCreateTiKVPeerService: false,
err: true,
tikvPeerSvcCreated: true,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
err: true,
tikvPeerSvcCreated: true,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
},
{
name: "error when create statefulset",
prepare: nil,
errWhenCreateStatefulSet: true,
errWhenCreateTiKVPeerService: false,
err: true,
tikvPeerSvcCreated: true,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
err: true,
tikvPeerSvcCreated: true,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
},
{
name: "error when create tikv peer service",
prepare: nil,
errWhenCreateStatefulSet: false,
errWhenCreateTiKVPeerService: true,
err: true,
tikvPeerSvcCreated: false,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
err: true,
tikvPeerSvcCreated: false,
setCreated: false,
pdStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
},
}

Expand Down Expand Up @@ -303,7 +303,7 @@ func TestTiKVMemberManagerSyncUpdate(t *testing.T) {
errWhenUpdateTiKVPeerService: false,
errWhenGetStores: false,
err: false,
expectTiKVPeerServiceFn: nil,
expectTiKVPeerServiceFn: nil,
expectStatefulSetFn: func(g *GomegaWithT, set *apps.StatefulSet, err error) {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(int(*set.Spec.Replicas)).To(Equal(4))
Expand All @@ -324,9 +324,9 @@ func TestTiKVMemberManagerSyncUpdate(t *testing.T) {
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
errWhenUpdateStatefulSet: false,
errWhenUpdateTiKVPeerService: false,
err: true,
expectTiKVPeerServiceFn: nil,
expectStatefulSetFn: nil,
err: true,
expectTiKVPeerServiceFn: nil,
expectStatefulSetFn: nil,
},
{
name: "error when update statefulset",
Expand All @@ -338,8 +338,8 @@ func TestTiKVMemberManagerSyncUpdate(t *testing.T) {
tombstoneStores: &controller.StoresInfo{Count: 0, Stores: []*controller.StoreInfo{}},
errWhenUpdateStatefulSet: true,
errWhenUpdateTiKVPeerService: false,
err: true,
expectTiKVPeerServiceFn: nil,
err: true,
expectTiKVPeerServiceFn: nil,
expectStatefulSetFn: func(g *GomegaWithT, set *apps.StatefulSet, err error) {
g.Expect(err).NotTo(HaveOccurred())
},
Expand All @@ -356,7 +356,7 @@ func TestTiKVMemberManagerSyncUpdate(t *testing.T) {
errWhenUpdateTiKVPeerService: false,
errWhenGetStores: true,
err: true,
expectTiKVPeerServiceFn: nil,
expectTiKVPeerServiceFn: nil,
expectStatefulSetFn: func(g *GomegaWithT, set *apps.StatefulSet, err error) {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(int(*set.Spec.Replicas)).To(Equal(3))
Expand Down

0 comments on commit 4d191cc

Please sign in to comment.