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:
parent
c4bfe5faf3
commit
4aec97ed27
|
|
@ -15,7 +15,6 @@ import (
|
||||||
"github.com/litmuschaos/litmus/litmus-portal/cluster-agents/subscriber/pkg/types"
|
"github.com/litmuschaos/litmus/litmus-portal/cluster-agents/subscriber/pkg/types"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
v1 "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/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime/serializer/yaml"
|
"k8s.io/apimachinery/pkg/runtime/serializer/yaml"
|
||||||
)
|
)
|
||||||
|
|
@ -35,9 +34,15 @@ func getChaosData(nodeStatus v1alpha13.NodeStatus, engineName, engineNS string,
|
||||||
cd.ProbeSuccessPercentage = "0"
|
cd.ProbeSuccessPercentage = "0"
|
||||||
cd.FailStep = ""
|
cd.FailStep = ""
|
||||||
cd.EngineUID = string(crd.ObjectMeta.UID)
|
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 {
|
if len(crd.Status.Experiments) == 0 {
|
||||||
return cd, nil
|
return cd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// considering chaosengine will only have 1 experiment
|
// considering chaosengine will only have 1 experiment
|
||||||
cd.ExperimentPod = crd.Status.Experiments[0].ExpPod
|
cd.ExperimentPod = crd.Status.Experiments[0].ExpPod
|
||||||
cd.RunnerPod = crd.Status.Experiments[0].Runner
|
cd.RunnerPod = crd.Status.Experiments[0].Runner
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue