Skip to content

Commit

Permalink
feat: fix ut error
Browse files Browse the repository at this point in the history
Signed-off-by: xdlbdy <xdlbdy@gmail.com>
  • Loading branch information
xdlbdy committed Mar 25, 2023
1 parent 466e91a commit f3cad76
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/controller/trigger/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/golang/mock/gomock"
. "github.com/smartystreets/goconvey/convey"

"github.com/vanus-labs/vanus/pkg/cluster"
ctrlpb "github.com/vanus-labs/vanus/proto/pkg/controller"
metapb "github.com/vanus-labs/vanus/proto/pkg/meta"

Expand Down Expand Up @@ -121,10 +122,17 @@ func TestController_CreateSubscription(t *testing.T) {
subManager := subscription.NewMockManager(mockCtrl)
ctrl.subscriptionManager = subManager
ctrl.scheduler = worker.NewSubscriptionScheduler(ctrl.workerManager, ctrl.subscriptionManager)

mockCluster := cluster.NewMockCluster(mockCtrl)
ctrl.cl = mockCluster
Convey("create subscription", func() {
subManager.EXPECT().GetSubscriptionByName(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil)
subManager.EXPECT().AddSubscription(gomock.Any(), gomock.Any()).AnyTimes().Return(nil)
mockNsSvc := cluster.NewMockNamespaceService(mockCtrl)
mockEbSvc := cluster.NewMockEventbusService(mockCtrl)
mockCluster.EXPECT().NamespaceService().AnyTimes().Return(mockNsSvc)
mockCluster.EXPECT().EventbusService().AnyTimes().Return(mockEbSvc)
mockNsSvc.EXPECT().GetNamespace(gomock.Any(), gomock.Any()).AnyTimes().Return(nil, nil)
mockEbSvc.EXPECT().GetEventbus(gomock.Any(), gomock.Any()).AnyTimes().Return(nil, nil)
create := &ctrlpb.CreateSubscriptionRequest{
Subscription: &ctrlpb.SubscriptionRequest{
NamespaceId: vanus.NewTestID().Uint64(),
Expand Down

0 comments on commit f3cad76

Please sign in to comment.