Skip to content

Commit

Permalink
chore: Fixing broken tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones committed Apr 11, 2023
1 parent 55dda43 commit c809af3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
11 changes: 6 additions & 5 deletions pkg/analyzer/hpaAnalyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,7 +24,7 @@ func TestHPAAnalyzer(t *testing.T) {
},
})
hpaAnalyzer := HpaAnalyzer{}
config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -55,7 +56,7 @@ func TestHPAAnalyzerWithMultipleHPA(t *testing.T) {
},
)
hpaAnalyzer := HpaAnalyzer{}
config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -86,7 +87,7 @@ func TestHPAAnalyzerWithUnsuportedScaleTargetRef(t *testing.T) {
})
hpaAnalyzer := HpaAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -133,7 +134,7 @@ func TestHPAAnalyzerWithNonExistentScaleTargetRef(t *testing.T) {
})
hpaAnalyzer := HpaAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -188,7 +189,7 @@ func TestHPAAnalyzerWithExistingScaleTargetRef(t *testing.T) {
)
hpaAnalyzer := HpaAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/analyzer/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,7 +24,7 @@ func TestIngressAnalyzer(t *testing.T) {
})
ingressAnalyzer := IngressAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -56,7 +57,7 @@ func TestIngressAnalyzerWithMultipleIngresses(t *testing.T) {
)
ingressAnalyzer := IngressAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand All @@ -83,7 +84,7 @@ func TestIngressAnalyzerWithoutIngressClassAnnotation(t *testing.T) {
})
ingressAnalyzer := IngressAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down
5 changes: 3 additions & 2 deletions pkg/analyzer/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -31,15 +32,15 @@ func TestPodAnalyzer(t *testing.T) {
},
})

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Context: context.Background(),
Namespace: "default",
}
podAnalyzer := PodAnalyzer{}
var analysisResults []Result
var analysisResults []common.Result
analysisResults, err := podAnalyzer.Analyze(config)
if err != nil {
t.Error(err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/analyzer/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -32,7 +33,7 @@ func TestServiceAnalyzer(t *testing.T) {
},
}})

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/analyzer/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -23,7 +24,7 @@ func TestStatefulSetAnalyzer(t *testing.T) {
})
statefulSetAnalyzer := StatefulSetAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand All @@ -50,7 +51,7 @@ func TestStatefulSetAnalyzerWithoutService(t *testing.T) {
})
statefulSetAnalyzer := StatefulSetAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down Expand Up @@ -115,7 +116,7 @@ func TestStatefulSetAnalyzerMissingStorageClass(t *testing.T) {
})
statefulSetAnalyzer := StatefulSetAnalyzer{}

config := Analyzer{
config := common.Analyzer{
Client: &kubernetes.Client{
Client: clientset,
},
Expand Down
4 changes: 0 additions & 4 deletions pkg/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down

0 comments on commit c809af3

Please sign in to comment.