mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-21 11:17:17 +00:00
chore: gofmt fix and enable in CI (#414)
* gofmt the files Signed-off-by: Peter Pan <Peter.Pan@daocloud.io> * add UT and goFMT to PR Gate (Github Action for PR) Signed-off-by: Peter Pan <Peter.Pan@daocloud.io> --------- Signed-off-by: Peter Pan <Peter.Pan@daocloud.io> Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
8
.github/workflows/test.yaml
vendored
8
.github/workflows/test.yaml
vendored
@@ -23,5 +23,9 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
- name: Unit Test
|
||||
run: make test
|
||||
|
||||
- name: Fmt Test
|
||||
run: fmtFiles=$(make fmt); if [ "$fmtFiles" != "" ];then exit 1; fi
|
||||
|
||||
|
@@ -57,7 +57,7 @@ func (a *NoOpAIClient) Parse(ctx context.Context, prompt []string, cache cache.I
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = cache.Store(cacheKey, base64.StdEncoding.EncodeToString([]byte(response)))
|
||||
err = cache.Store(cacheKey, base64.StdEncoding.EncodeToString([]byte(response)))
|
||||
|
||||
if err != nil {
|
||||
color.Red("error storing value to cache: %v", err)
|
||||
|
@@ -205,15 +205,15 @@ func TestHPAAnalyzerWithExistingScaleTargetRefAsDeployment(t *testing.T) {
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "example",
|
||||
Name: "example",
|
||||
Image: "nginx",
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"memory": resource.MustParse("128Mi"),
|
||||
},
|
||||
Limits: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"memory": resource.MustParse("256Mi"),
|
||||
},
|
||||
},
|
||||
@@ -269,15 +269,15 @@ func TestHPAAnalyzerWithExistingScaleTargetRefAsReplicationController(t *testing
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "example",
|
||||
Name: "example",
|
||||
Image: "nginx",
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"memory": resource.MustParse("128Mi"),
|
||||
},
|
||||
Limits: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"memory": resource.MustParse("256Mi"),
|
||||
},
|
||||
},
|
||||
@@ -333,15 +333,15 @@ func TestHPAAnalyzerWithExistingScaleTargetRefAsReplicaSet(t *testing.T) {
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "example",
|
||||
Name: "example",
|
||||
Image: "nginx",
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"memory": resource.MustParse("128Mi"),
|
||||
},
|
||||
Limits: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"memory": resource.MustParse("256Mi"),
|
||||
},
|
||||
},
|
||||
@@ -397,15 +397,15 @@ func TestHPAAnalyzerWithExistingScaleTargetRefAsStatefulSet(t *testing.T) {
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "example",
|
||||
Name: "example",
|
||||
Image: "nginx",
|
||||
Resources: corev1.ResourceRequirements{
|
||||
Requests: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"cpu": resource.MustParse("100m"),
|
||||
"memory": resource.MustParse("128Mi"),
|
||||
},
|
||||
Limits: corev1.ResourceList{
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"cpu": resource.MustParse("200m"),
|
||||
"memory": resource.MustParse("256Mi"),
|
||||
},
|
||||
},
|
||||
@@ -461,7 +461,7 @@ func TestHPAAnalyzerWithExistingScaleTargetRefWithoutSpecifyingResources(t *test
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "example",
|
||||
Name: "example",
|
||||
Image: "nginx",
|
||||
},
|
||||
},
|
||||
@@ -487,7 +487,7 @@ func TestHPAAnalyzerWithExistingScaleTargetRefWithoutSpecifyingResources(t *test
|
||||
var errorFound bool
|
||||
for _, analysis := range analysisResults {
|
||||
for _, err := range analysis.Error {
|
||||
if strings.Contains(err.Text, "does not have resource configured."){
|
||||
if strings.Contains(err.Text, "does not have resource configured.") {
|
||||
errorFound = true
|
||||
break
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ func (NodeAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) {
|
||||
}
|
||||
|
||||
if len(failures) > 0 {
|
||||
preAnalysis[node.Name]= common.PreAnalysis{
|
||||
preAnalysis[node.Name] = common.PreAnalysis{
|
||||
Node: node,
|
||||
FailureDetails: failures,
|
||||
}
|
||||
|
Reference in New Issue
Block a user