chore: updated analysis_test.go

Signed-off-by: chetan gupta <chetangupta123raj@gmail.com>
This commit is contained in:
chetan gupta 2023-04-11 20:59:41 +05:30
parent 21dc61c04f
commit 825e9a43bd

View File

@ -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",
},
},
}