From c809af3f47388599fda3a88a4638feae1dc90492 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Tue, 11 Apr 2023 12:42:02 +0100 Subject: [PATCH] chore: Fixing broken tests Signed-off-by: Alex Jones --- pkg/analyzer/hpaAnalyzer_test.go | 11 ++++++----- pkg/analyzer/ingress_test.go | 7 ++++--- pkg/analyzer/pod_test.go | 5 +++-- pkg/analyzer/service_test.go | 3 ++- pkg/analyzer/statefulset_test.go | 7 ++++--- pkg/integration/integration.go | 4 ---- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pkg/analyzer/hpaAnalyzer_test.go b/pkg/analyzer/hpaAnalyzer_test.go index cbe0a1a9cb..d29bd0b2e7 100644 --- a/pkg/analyzer/hpaAnalyzer_test.go +++ b/pkg/analyzer/hpaAnalyzer_test.go @@ -5,6 +5,7 @@ import ( "strings" "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" "github.com/magiconair/properties/assert" appsv1 "k8s.io/api/apps/v1" @@ -23,7 +24,7 @@ func TestHPAAnalyzer(t *testing.T) { }, }) hpaAnalyzer := HpaAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -55,7 +56,7 @@ func TestHPAAnalyzerWithMultipleHPA(t *testing.T) { }, ) hpaAnalyzer := HpaAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -86,7 +87,7 @@ func TestHPAAnalyzerWithUnsuportedScaleTargetRef(t *testing.T) { }) hpaAnalyzer := HpaAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -133,7 +134,7 @@ func TestHPAAnalyzerWithNonExistentScaleTargetRef(t *testing.T) { }) hpaAnalyzer := HpaAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -188,7 +189,7 @@ func TestHPAAnalyzerWithExistingScaleTargetRef(t *testing.T) { ) hpaAnalyzer := HpaAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, diff --git a/pkg/analyzer/ingress_test.go b/pkg/analyzer/ingress_test.go index bb1eef9fde..e885ee9952 100644 --- a/pkg/analyzer/ingress_test.go +++ b/pkg/analyzer/ingress_test.go @@ -5,6 +5,7 @@ import ( "strings" "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" "github.com/magiconair/properties/assert" networkingv1 "k8s.io/api/networking/v1" @@ -23,7 +24,7 @@ func TestIngressAnalyzer(t *testing.T) { }) ingressAnalyzer := IngressAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -56,7 +57,7 @@ func TestIngressAnalyzerWithMultipleIngresses(t *testing.T) { ) ingressAnalyzer := IngressAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -83,7 +84,7 @@ func TestIngressAnalyzerWithoutIngressClassAnnotation(t *testing.T) { }) ingressAnalyzer := IngressAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, diff --git a/pkg/analyzer/pod_test.go b/pkg/analyzer/pod_test.go index 609541fed8..e23eeb19a4 100644 --- a/pkg/analyzer/pod_test.go +++ b/pkg/analyzer/pod_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" "github.com/magiconair/properties/assert" v1 "k8s.io/api/core/v1" @@ -31,7 +32,7 @@ func TestPodAnalyzer(t *testing.T) { }, }) - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -39,7 +40,7 @@ func TestPodAnalyzer(t *testing.T) { Namespace: "default", } podAnalyzer := PodAnalyzer{} - var analysisResults []Result + var analysisResults []common.Result analysisResults, err := podAnalyzer.Analyze(config) if err != nil { t.Error(err) diff --git a/pkg/analyzer/service_test.go b/pkg/analyzer/service_test.go index b7d2dace5a..68755704ba 100644 --- a/pkg/analyzer/service_test.go +++ b/pkg/analyzer/service_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" "github.com/magiconair/properties/assert" v1 "k8s.io/api/core/v1" @@ -32,7 +33,7 @@ func TestServiceAnalyzer(t *testing.T) { }, }}) - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, diff --git a/pkg/analyzer/statefulset_test.go b/pkg/analyzer/statefulset_test.go index b00c8d0680..5f20ebfd5a 100644 --- a/pkg/analyzer/statefulset_test.go +++ b/pkg/analyzer/statefulset_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/common" "github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes" "github.com/magiconair/properties/assert" appsv1 "k8s.io/api/apps/v1" @@ -23,7 +24,7 @@ func TestStatefulSetAnalyzer(t *testing.T) { }) statefulSetAnalyzer := StatefulSetAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -50,7 +51,7 @@ func TestStatefulSetAnalyzerWithoutService(t *testing.T) { }) statefulSetAnalyzer := StatefulSetAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, @@ -115,7 +116,7 @@ func TestStatefulSetAnalyzerMissingStorageClass(t *testing.T) { }) statefulSetAnalyzer := StatefulSetAnalyzer{} - config := Analyzer{ + config := common.Analyzer{ Client: &kubernetes.Client{ Client: clientset, }, diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index 167eea35d9..8837c7e799 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -23,10 +23,6 @@ type IIntegration interface { type Integration struct { } -type IntegrationProvider struct { - Active []string `mapstructure:"active"` -} - var integrations = map[string]IIntegration{ "trivy": trivy.NewTrivy(), }