From 825e9a43bd3ab7aa3ea52f315993cd778ea039e3 Mon Sep 17 00:00:00 2001 From: chetan gupta Date: Tue, 11 Apr 2023 20:59:41 +0530 Subject: [PATCH] chore: updated analysis_test.go Signed-off-by: chetan gupta --- pkg/analysis/analysis_test.go | 49 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/pkg/analysis/analysis_test.go b/pkg/analysis/analysis_test.go index c3ec32c921..c4c75d122a 100644 --- a/pkg/analysis/analysis_test.go +++ b/pkg/analysis/analysis_test.go @@ -3,9 +3,10 @@ package analysis import ( "encoding/json" "fmt" + "testing" + "github.com/k8sgpt-ai/k8sgpt/pkg/analyzer" "github.com/stretchr/testify/require" - "testing" ) func TestAnalysis_NoProblemJsonOutput(t *testing.T) { @@ -42,11 +43,12 @@ func TestAnalysis_ProblemJsonOutput(t *testing.T) { analysis := Analysis{ Results: []analyzer.Result{ { - "Deployment", - "test-deployment", - []string{"test-problem"}, - "test-solution", - "parent-resource"}, + Kind: "Deployment", + Name: "test-deployment", + Error: []string{"test-problem"}, + Details: "test-solution", + ParentObject: "parent-resource", + }, }, Namespace: "default", } @@ -55,11 +57,13 @@ func TestAnalysis_ProblemJsonOutput(t *testing.T) { Status: StateProblemDetected, Problems: 1, Results: []analyzer.Result{ - {"Deployment", - "test-deployment", - []string{"test-problem"}, - "test-solution", - "parent-resource"}, + { + Kind: "Deployment", + Name: "test-deployment", + Error: []string{"test-problem"}, + Details: "test-solution", + ParentObject: "parent-resource", + }, }, } @@ -84,11 +88,12 @@ func TestAnalysis_MultipleProblemJsonOutput(t *testing.T) { analysis := Analysis{ Results: []analyzer.Result{ { - "Deployment", - "test-deployment", - []string{"test-problem", "another-test-problem"}, - "test-solution", - "parent-resource"}, + Kind: "Deployment", + Name: "test-deployment", + Error: []string{"test-problem", "another-test-problem"}, + Details: "test-solution", + ParentObject: "parent-resource", + }, }, Namespace: "default", } @@ -97,11 +102,13 @@ func TestAnalysis_MultipleProblemJsonOutput(t *testing.T) { Status: StateProblemDetected, Problems: 2, Results: []analyzer.Result{ - {"Deployment", - "test-deployment", - []string{"test-problem", "another-test-problem"}, - "test-solution", - "parent-resource"}, + { + Kind: "Deployment", + Name: "test-deployment", + Error: []string{"test-problem", "another-test-problem"}, + Details: "test-solution", + ParentObject: "parent-resource", + }, }, }