openshift / openshift-azure

Azure Red Hat Openshift
https://azure.microsoft.com/en-us/services/openshift/
Apache License 2.0
49 stars 51 forks source link

Unit tests broken in CI with *gomock.Controller has no field or method T #870

Closed charlesakalugwu closed 5 years ago

charlesakalugwu commented 5 years ago

All CI tests are currently failing due to seeminly bad code generation by the gomock version which is installed in CI

go test ./... -coverprofile=coverage.out
?       github.com/openshift/openshift-azure/cmd/azure-controllers  [no test files]
?       github.com/openshift/openshift-azure/cmd/createorupdate [no test files]
# github.com/openshift/openshift-azure/pkg/util/mocks/mock_azureclient
pkg/util/mocks/mock_azureclient/azureclient.go:47:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:55:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:84:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:92:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:98:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:107:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:113:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:122:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:128:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:137:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/azureclient.go:137:14: too many errors
# github.com/openshift/openshift-azure/pkg/util/mocks/mock_azureclient/mock_storage
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:42:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:50:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:79:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:87:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:116:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:125:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:131:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:140:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:146:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:154:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_azureclient/mock_storage/storage.go:154:14: too many errors
?       github.com/openshift/openshift-azure/cmd/etcdbackup [no test files]
?       github.com/openshift/openshift-azure/cmd/metricsbridge  [no test files]
?       github.com/openshift/openshift-azure/cmd/recoveretcdcluster [no test files]
# github.com/openshift/openshift-azure/pkg/util/mocks/mock_arm
pkg/util/mocks/mock_arm/arm.go:41:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_arm/arm.go:50:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
# github.com/openshift/openshift-azure/pkg/util/mocks/mock_cluster
pkg/util/mocks/mock_cluster/types.go:41:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:49:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:55:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:63:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:69:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:77:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:83:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:91:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:97:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:105:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_cluster/types.go:105:14: too many errors
# github.com/openshift/openshift-azure/pkg/util/mocks/mock_wait
pkg/util/mocks/mock_wait/wait.go:39:8: m.ctrl.T undefined (type *gomock.Controller has no field or method T)
pkg/util/mocks/mock_wait/wait.go:48:14: mr.mock.ctrl.T undefined (type *gomock.Controller has no field or method T)

/kind bug /cc @jim-minter @kargakis @asalkeld

charlesakalugwu commented 5 years ago

/assign asalkeld

asalkeld commented 5 years ago

the make verify is returning this


+ diff -r /go/src/github.com/openshift/openshift-azure/hack/../pkg/util/mocks/mock_arm/arm.go /tmp/tmp.SLnfQMX59r/pkg/util/mocks/mock_arm/arm.go
40a41
>   m.ctrl.T.Helper()
48a50
>   mr.mock.ctrl.T.Helper()

most likely a different version of mockgen is getting used. I see 1.2.0 was released 2 days ago. https://github.com/golang/mock/releases

Since we are installing via gogenerate, I am not sure on how to fix the version number in "go get". I can just try update the version of our vendored gomock.

shuza commented 4 years ago

the make verify is returning this


+ diff -r /go/src/github.com/openshift/openshift-azure/hack/../pkg/util/mocks/mock_arm/arm.go /tmp/tmp.SLnfQMX59r/pkg/util/mocks/mock_arm/arm.go
40a41
>     m.ctrl.T.Helper()
48a50
>     mr.mock.ctrl.T.Helper()

most likely a different version of mockgen is getting used. I see 1.2.0 was released 2 days ago. https://github.com/golang/mock/releases

Since we are installing via gogenerate, I am not sure on how to fix the version number in "go get". I can just try update the version of our vendored gomock.

yes. I solve it by updating mockgen version in go.mod file.