Skip to content

Commit

Permalink
Added fail check for stopped engine with no experiments (#2897)
Browse files Browse the repository at this point in the history
* added fail check for stopped engine with no exps

Signed-off-by: Soumya Ghosh Dastidar <[email protected]>

* goimports

Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
  • Loading branch information
gdsoumya authored Jun 15, 2021
1 parent c4bfe5f commit 4aec97e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion litmus-portal/cluster-agents/subscriber/pkg/events/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down

0 comments on commit 4aec97e

Please sign in to comment.