@@ -3,6 +3,7 @@ package probe
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
+ "github.com/litmuschaos/litmus-go/pkg/utils"
6
7
"os/exec"
7
8
"reflect"
8
9
"strconv"
@@ -115,6 +116,9 @@ func httpGet(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
115
116
// getting the response from the given url
116
117
resp , err := client .Get (probe .HTTPProbeInputs .URL )
117
118
if err != nil {
119
+ if utils .HttpTimeout (err ) {
120
+ return cerrors.Error {ErrorCode : cerrors .FailureTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
121
+ }
118
122
return cerrors.Error {ErrorCode : cerrors .ErrorTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
119
123
}
120
124
@@ -159,6 +163,9 @@ func httpPost(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
159
163
Try (func (attempt uint ) error {
160
164
resp , err := client .Post (probe .HTTPProbeInputs .URL , probe .HTTPProbeInputs .Method .Post .ContentType , strings .NewReader (body ))
161
165
if err != nil {
166
+ if utils .HttpTimeout (err ) {
167
+ return cerrors.Error {ErrorCode : cerrors .FailureTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
168
+ }
162
169
return cerrors.Error {ErrorCode : cerrors .ErrorTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
163
170
}
164
171
code := strconv .Itoa (resp .StatusCode )
@@ -244,6 +251,7 @@ loop:
244
251
for index := range chaosresult .ProbeDetails {
245
252
if chaosresult .ProbeDetails [index ].Name == probe .Name {
246
253
chaosresult .ProbeDetails [index ].IsProbeFailedWithError = err
254
+ chaosresult .ProbeDetails [index ].HasProbeCompleted = true
247
255
chaosresult .ProbeDetails [index ].Status .Description = getDescription (err )
248
256
log .Errorf ("The %v http probe has been Failed, err: %v" , probe .Name , err )
249
257
isExperimentFailed = true
@@ -395,6 +403,7 @@ loop:
395
403
for index := range chaosresult .ProbeDetails {
396
404
if chaosresult .ProbeDetails [index ].Name == probe .Name {
397
405
chaosresult .ProbeDetails [index ].IsProbeFailedWithError = err
406
+ chaosresult .ProbeDetails [index ].HasProbeCompleted = true
398
407
chaosresult .ProbeDetails [index ].Status .Description = getDescription (err )
399
408
isExperimentFailed = true
400
409
break loop
0 commit comments