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

Ft ginkgo v2 #74

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ init:
go install github.com/swaggo/swag/cmd/swag@v1.7.6
# for make mock
go install github.com/golang/mock/mockgen@v1.4.4
# for ginkgo
go install github.com/onsi/ginkgo/v2/ginkgo@latest

dep:
go mod tidy
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/jmoiron/sqlx v1.2.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.0.0
github.com/onsi/gomega v1.17.0
github.com/parnurzeal/gorequest v0.2.16
github.com/patrickmn/go-cache v2.1.0+incompatible
Expand Down Expand Up @@ -78,7 +78,6 @@ require (
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down Expand Up @@ -108,7 +107,6 @@ require (
golang.org/x/tools v0.1.8 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
Expand Down Expand Up @@ -561,6 +562,8 @@ github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISq
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ=
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
Expand Down
2 changes: 1 addition & 1 deletion iam_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package main_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/and_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition/operator"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/any_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/base_condition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"errors"
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/base_logical_condition_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/bool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/condition_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package condition_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/numeric_cmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package condition

import (
"github.com/TencentBlueKing/iam-go-sdk/expression/eval"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition/operator"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/or_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition/operator"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/string_equals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package condition

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/condition/string_prefix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package condition
import (
abacTypes "iam/pkg/abac/types"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/entrance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/evalctx/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"iam/pkg/abac/pdp/condition"
pdptypes "iam/pkg/abac/pdp/types"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
gocache "github.com/patrickmn/go-cache"
"github.com/stretchr/testify/assert"

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/evalctx/evalctx_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package evalctx_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/evaluation/evaluation_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package evaluation_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/evaluation/evaluation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"time"

"github.com/TencentBlueKing/gopkg/cache/memory"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/pdp_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package pdp_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/translate/translate_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package translate_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/abac/pdp/translate/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package translate
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/condition"
Expand Down Expand Up @@ -74,8 +74,8 @@ var _ = Describe("Expression", func() {
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), "OR", expr["op"])
assert.ElementsMatch(GinkgoT(), want["content"], expr["content"])
//assert.Equal(GinkgoT(), want, expr)
//assert.True(GinkgoT(), assert.ObjectsAreEqualValues(want, expr))
// assert.Equal(GinkgoT(), want, expr)
// assert.True(GinkgoT(), assert.ObjectsAreEqualValues(want, expr))

})

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/types/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package types
import (
"strings"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/types/policy_condition_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pdp/types"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/types/types_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package types_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pdp/types/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package types

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pip/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pip"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pip/pip_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package pip_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pip/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pip"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/pip/subject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/pip"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/prp/common/changelist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"github.com/agiledragon/gomonkey/v2"
rds "github.com/go-redis/redis/v8"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/abac/prp/common"
Expand Down
2 changes: 1 addition & 1 deletion pkg/abac/prp/common/common_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package common_test
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
29 changes: 15 additions & 14 deletions pkg/abac/prp/expression/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,35 @@ import (

"github.com/agiledragon/gomonkey/v2"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"iam/pkg/service"
"iam/pkg/service/mock"

"iam/pkg/service/types"
)

var _ = Describe("Database", func() {

Describe("newDatabaseRetriever", func() {
var ctl *gomock.Controller
var patches *gomonkey.Patches
It("ok", func() {
var ctl *gomock.Controller
var patches *gomonkey.Patches

ctl = gomock.NewController(GinkgoT())
patches = gomonkey.NewPatches()
ctl = gomock.NewController(GinkgoT())
patches = gomonkey.NewPatches()

mockPolicyService := mock.NewMockPolicyService(ctl)
patches.ApplyFunc(service.NewPolicyService, func() service.PolicyService {
return mockPolicyService
})
mockPolicyService := mock.NewMockPolicyService(ctl)
patches.ApplyFunc(service.NewPolicyService, func() service.PolicyService {
return mockPolicyService
})

r := newDatabaseRetriever()
assert.NotNil(GinkgoT(), r)
r := newDatabaseRetriever()
assert.NotNil(GinkgoT(), r)

ctl.Finish()
patches.Reset()
ctl.Finish()
patches.Reset()
})
})

Describe("retrieve", func() {
Expand Down
Loading