Added fail check for stopped engine with no experiments (#2897)

* added fail check for stopped engine with no exps

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* goimports

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
This commit is contained in:
Soumya Ghosh Dastidar 2021-06-15 18:16:22 +05:30 committed by GitHub
parent c4bfe5faf3
commit 4aec97ed27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,6 @@ import (
"github.com/litmuschaos/litmus/litmus-portal/cluster-agents/subscriber/pkg/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/serializer/yaml"
)
@ -35,9 +34,15 @@ func getChaosData(nodeStatus v1alpha13.NodeStatus, engineName, engineNS string,
cd.ProbeSuccessPercentage = "0"
cd.FailStep = ""
cd.EngineUID = string(crd.ObjectMeta.UID)
if strings.ToLower(string(crd.Status.EngineStatus)) == "stopped" {
cd.ExperimentVerdict = "Fail"
cd.ExperimentStatus = string(crd.Status.EngineStatus)
}
if len(crd.Status.Experiments) == 0 {
return cd, nil
}
// considering chaosengine will only have 1 experiment
cd.ExperimentPod = crd.Status.Experiments[0].ExpPod
cd.RunnerPod = crd.Status.Experiments[0].Runner