Skip to content

Commit

Permalink
Fix linters and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
databus23 committed Nov 4, 2022
1 parent 4ddfb44 commit 6cf0471
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/client/openstack/kluster/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/rules"
)

//MatchRule checks if input is matched by rule
// MatchRule checks if input is matched by rule
func MatchRule(input rules.SecGroupRule, rule rules.SecGroupRule) bool {

if input.Direction != rule.Direction {
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/flight/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func (m *MockFlightReconciler) EnsureInstanceSecurityGroupAssignment() []string
return args.Get(0).([]string)
}

func (m *MockFlightReconciler) EnsureKubernikusRulesInSecurityGroup() bool {
func (m *MockFlightReconciler) EnsureKubernikusRulesInSecurityGroup() (bool, error) {
args := m.Called()
return args.Bool(0)
return args.Bool(0), args.Error(1)
}

func (m *MockFlightReconciler) DeleteIncompletelySpawnedInstances() []string {
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestReconcile(t *testing.T) {
kluster.Status.Phase = models.KlusterPhaseRunning

reconciler := &MockFlightReconciler{}
reconciler.On("EnsureKubernikusRulesInSecurityGroup").Return(true)
reconciler.On("EnsureKubernikusRulesInSecurityGroup").Return(true, nil)
reconciler.On("EnsureInstanceSecurityGroupAssignment").Return([]string{})
reconciler.On("DeleteIncompletelySpawnedInstances").Return([]string{})
reconciler.On("DeleteErroredInstances").Return([]string{})
Expand All @@ -68,7 +68,7 @@ func TestReconcile(t *testing.T) {
factory := &MockFlightReconcilerFactory{}
factory.On("FlightReconciler", kluster).Return(reconciler, nil)

controller := &FlightController{factory, nil}
controller := &FlightController{factory, nil, nil}

_, err := controller.Reconcile(kluster)
assert.NoError(t, err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/flight/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ func TestEnsureKubernikusRulesInSecurityGroup(t *testing.T) {
log.NewNopLogger(),
}

ensured := reconciler.EnsureKubernikusRulesInSecurityGroup()
updated, err := reconciler.EnsureKubernikusRulesInSecurityGroup()
assert.NoError(t, err)
client.AssertCalled(t, "EnsureKubernikusRulesInSecurityGroup", kluster)
assert.True(t, ensured)
assert.True(t, updated)
}

0 comments on commit 6cf0471

Please sign in to comment.