@@ -32,11 +32,23 @@ func RunProbes(chaosDetails *types.ChaosDetails, clients clients.ClientSets, res
32
32
}
33
33
34
34
switch strings .ToLower (phase ) {
35
- //execute probes for the prechaos & duringchaos phase
36
- case "prechaos" , "duringchaos" :
35
+ //execute probes for the prechaos phase
36
+ case "prechaos" :
37
37
for _ , probe := range probes {
38
- if err := execute (probe , chaosDetails , clients , resultDetails , phase ); err != nil {
39
- return err
38
+ switch strings .ToLower (probe .Mode ) {
39
+ case "sot" , "edge" , "continuous" :
40
+ if err := execute (probe , chaosDetails , clients , resultDetails , phase ); err != nil {
41
+ return err
42
+ }
43
+ }
44
+ }
45
+ //execute probes for the duringchaos phase
46
+ case "duringchaos" :
47
+ for _ , probe := range probes {
48
+ if strings .ToLower (probe .Mode ) == "onchaos" {
49
+ if err := execute (probe , chaosDetails , clients , resultDetails , phase ); err != nil {
50
+ return err
51
+ }
40
52
}
41
53
}
42
54
default :
@@ -58,8 +70,11 @@ func RunProbes(chaosDetails *types.ChaosDetails, clients clients.ClientSets, res
58
70
}
59
71
// executes the eot and edge modes
60
72
for _ , probe := range probes {
61
- if err := execute (probe , chaosDetails , clients , resultDetails , phase ); err != nil {
62
- return err
73
+ switch strings .ToLower (probe .Mode ) {
74
+ case "eot" , "edge" :
75
+ if err := execute (probe , chaosDetails , clients , resultDetails , phase ); err != nil {
76
+ return err
77
+ }
63
78
}
64
79
}
65
80
}
@@ -137,7 +152,6 @@ func InitializeProbesInChaosResultDetails(chaosDetails *types.ChaosDetails, clie
137
152
tempProbe .Name = probe .Name
138
153
tempProbe .Type = probe .Type
139
154
tempProbe .Mode = probe .Mode
140
- tempProbe .Phase = "N/A"
141
155
tempProbe .RunCount = 0
142
156
tempProbe .Status = v1alpha1.ProbeStatus {
143
157
Verdict : "Awaited" ,
@@ -204,12 +218,8 @@ func markedVerdictInEnd(err error, resultDetails *types.ResultDetails, probe v1a
204
218
// counting the passed probes count to generate the score and mark the verdict as passed
205
219
// for edge, probe is marked as Passed if passed in both pre/post chaos checks
206
220
switch strings .ToLower (probe .Mode ) {
207
- case "edge" , "continuous" :
208
- if phase != "PreChaos" {
209
- resultDetails .PassedProbeCount ++
210
- }
211
- case "onchaos" :
212
- if phase != "DuringChaos" {
221
+ case "edge" :
222
+ if phase == "PostChaos" && getProbeVerdict (resultDetails , probe .Name , probe .Type ) != v1alpha1 .ProbeVerdictFailed {
213
223
resultDetails .PassedProbeCount ++
214
224
}
215
225
default :
@@ -313,3 +323,12 @@ func execute(probe v1alpha1.ProbeAttributes, chaosDetails *types.ChaosDetails, c
313
323
}
314
324
return nil
315
325
}
326
+
327
+ func getProbeVerdict (resultDetails * types.ResultDetails , name , probeType string ) v1alpha1.ProbeVerdict {
328
+ for _ , probe := range resultDetails .ProbeDetails {
329
+ if probe .Name == name && probe .Type == probeType {
330
+ return probe .Status .Verdict
331
+ }
332
+ }
333
+ return v1alpha1 .ProbeVerdictNA
334
+ }
0 commit comments