Skip to content

Commit

Permalink
chore: Convert Istio status checker mocks into stubs (#1473)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylimnardy authored Sep 24, 2024
1 parent 3abdc16 commit 01c6d4d
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 147 deletions.
3 changes: 0 additions & 3 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ packages:
interfaces:
DaemonSetAnnotator:
FlowHealthProber:
IstioStatusChecker:
OverridesHandler:
ErrorToMessageConverter:
github.com/kyma-project/telemetry-manager/internal/reconciler/tracepipeline:
interfaces:
FlowHealthProber:
GatewayApplierDeleter:
GatewayConfigBuilder:
IstioStatusChecker:
OverridesHandler:
PipelineLock:
ErrorToMessageConverter:
Expand All @@ -29,7 +27,6 @@ packages:
FlowHealthProber:
GatewayApplierDeleter:
GatewayConfigBuilder:
IstioStatusChecker:
OverridesHandler:
PipelineLock:
ErrorToMessageConverter:
Expand Down
46 changes: 0 additions & 46 deletions internal/reconciler/logpipeline/mocks/istio_status_checker.go

This file was deleted.

3 changes: 1 addition & 2 deletions internal/reconciler/logpipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func TestReconcile(t *testing.T) {
overridesHandlerStub := &mocks.OverridesHandler{}
overridesHandlerStub.On("LoadOverrides", context.Background()).Return(&overrides.Config{}, nil)

istioStatusCheckerStub := &mocks.IstioStatusChecker{}
istioStatusCheckerStub.On("IsIstioActive", mock.Anything).Return(false)
istioStatusCheckerStub := &stubs.IstioStatusChecker{IsActive: false}

testConfig := Config{
DaemonSet: types.NamespacedName{Name: "test-telemetry-fluent-bit", Namespace: "default"},
Expand Down
13 changes: 13 additions & 0 deletions internal/reconciler/logpipeline/stubs/istio_status_checker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package stubs

import (
"context"
)

type IstioStatusChecker struct {
IsActive bool
}

func (i *IstioStatusChecker) IsIstioActive(ctx context.Context) bool {
return i.IsActive
}
46 changes: 0 additions & 46 deletions internal/reconciler/metricpipeline/mocks/istio_status_checker.go

This file was deleted.

3 changes: 1 addition & 2 deletions internal/reconciler/metricpipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func TestReconcile(t *testing.T) {
overridesHandlerStub := &mocks.OverridesHandler{}
overridesHandlerStub.On("LoadOverrides", context.Background()).Return(&overrides.Config{}, nil)

istioStatusCheckerStub := &mocks.IstioStatusChecker{}
istioStatusCheckerStub.On("IsIstioActive", mock.Anything).Return(false)
istioStatusCheckerStub := &stubs.IstioStatusChecker{IsActive: false}

testConfig := Config{
Gateway: otelcollector.GatewayConfig{
Expand Down
13 changes: 13 additions & 0 deletions internal/reconciler/metricpipeline/stubs/istio_status_checker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package stubs

import (
"context"
)

type IstioStatusChecker struct {
IsActive bool
}

func (i *IstioStatusChecker) IsIstioActive(ctx context.Context) bool {
return i.IsActive
}
46 changes: 0 additions & 46 deletions internal/reconciler/tracepipeline/mocks/istio_status_checker.go

This file was deleted.

3 changes: 1 addition & 2 deletions internal/reconciler/tracepipeline/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ func TestReconcile(t *testing.T) {
overridesHandlerStub := &mocks.OverridesHandler{}
overridesHandlerStub.On("LoadOverrides", context.Background()).Return(&overrides.Config{}, nil)

istioStatusCheckerStub := &mocks.IstioStatusChecker{}
istioStatusCheckerStub.On("IsIstioActive", mock.Anything).Return(false)
istioStatusCheckerStub := &stubs.IstioStatusChecker{IsActive: false}

testConfig := Config{Gateway: otelcollector.GatewayConfig{
Config: otelcollector.Config{
Expand Down
13 changes: 13 additions & 0 deletions internal/reconciler/tracepipeline/stubs/istio_status_checker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package stubs

import (
"context"
)

type IstioStatusChecker struct {
IsActive bool
}

func (i *IstioStatusChecker) IsIstioActive(ctx context.Context) bool {
return i.IsActive
}

0 comments on commit 01c6d4d

Please sign in to comment.