Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
omris94 committed Dec 18, 2024
1 parent eac02af commit 6b60f78
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package protected_service_reconcilers
import (
"context"
otterizev2alpha1 "github.com/otterize/intents-operator/src/operator/api/v2alpha1"
protectedservicesmock "github.com/otterize/intents-operator/src/operator/controllers/protected_service_reconcilers/mocks"
"github.com/otterize/intents-operator/src/shared/testbase"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
Expand Down Expand Up @@ -34,14 +33,12 @@ func init() {

type DefaultDenyReconcilerTestSuite struct {
testbase.MocksSuiteBase
reconciler *DefaultDenyReconciler
extNetpolHandler *protectedservicesmock.MockExternalNepolHandler
reconciler *DefaultDenyReconciler
}

func (s *DefaultDenyReconcilerTestSuite) SetupTest() {
s.MocksSuiteBase.SetupTest()

s.extNetpolHandler = protectedservicesmock.NewMockExternalNepolHandler(s.Controller)
s.reconciler = NewDefaultDenyReconciler(s.Client, true)
}

Expand Down Expand Up @@ -87,7 +84,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServicesCreateGlobalNetpol
otterizev2alpha1.OtterizeNetworkPolicyServiceDefaultDeny: "true",
}).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -150,7 +146,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServicesCreate() {
}
s.Client.EXPECT().Create(gomock.Any(), gomock.Eq(&policy)).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -228,7 +223,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServicesCreate_KindService
}
s.Client.EXPECT().Create(gomock.Any(), gomock.Eq(&policy)).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -322,7 +316,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServicesCreateFromMultiple
s.Client.EXPECT().Create(gomock.Any(), gomock.Eq(&serverPolicy)).Return(nil).Times(1)
s.Client.EXPECT().Create(gomock.Any(), gomock.Eq(&otherServerPolicy)).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -410,7 +403,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServiceNotInList() {
}
s.Client.EXPECT().Create(gomock.Any(), gomock.Eq(&otherProtectedServicePolicy)).Return(nil).Times(1)
s.Client.EXPECT().Delete(gomock.Any(), gomock.Eq(&policy)).Return(nil).Times(1)
s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())

res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
Expand Down Expand Up @@ -479,7 +471,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServiceResourceBeingDelete

s.Client.EXPECT().Delete(gomock.Any(), gomock.Eq(&policy)).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -529,7 +520,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServiceResourceAlreadyDele

s.Client.EXPECT().Delete(gomock.Any(), gomock.Eq(&policy)).Return(nil).Times(1)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -629,8 +619,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServiceAlreadyExists() {

// We expect no other calls to the client since the policy already exists and is valid

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())

res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down Expand Up @@ -714,7 +702,6 @@ func (s *DefaultDenyReconcilerTestSuite) TestProtectedServiceUpdate() {

s.Client.EXPECT().Update(gomock.Any(), gomock.Eq(&fixedPolicy)).Return(nil)

s.extNetpolHandler.EXPECT().HandleAllPods(gomock.Any())
res, err := s.reconciler.Reconcile(context.Background(), request)
s.Require().Empty(res)
s.Require().NoError(err)
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 6b60f78

Please sign in to comment.