@@ -3,6 +3,7 @@ package probe
33import (
44 "bytes"
55 "fmt"
6+ "github.com/litmuschaos/litmus-go/pkg/utils"
67 "os/exec"
78 "reflect"
89 "strconv"
@@ -115,6 +116,9 @@ func httpGet(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
115116 // getting the response from the given url
116117 resp , err := client .Get (probe .HTTPProbeInputs .URL )
117118 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+ }
118122 return cerrors.Error {ErrorCode : cerrors .ErrorTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
119123 }
120124
@@ -159,6 +163,9 @@ func httpPost(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
159163 Try (func (attempt uint ) error {
160164 resp , err := client .Post (probe .HTTPProbeInputs .URL , probe .HTTPProbeInputs .Method .Post .ContentType , strings .NewReader (body ))
161165 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+ }
162169 return cerrors.Error {ErrorCode : cerrors .ErrorTypeHttpProbe , Target : fmt .Sprintf ("{name: %v}" , probe .Name ), Reason : err .Error ()}
163170 }
164171 code := strconv .Itoa (resp .StatusCode )
@@ -244,6 +251,7 @@ loop:
244251 for index := range chaosresult .ProbeDetails {
245252 if chaosresult .ProbeDetails [index ].Name == probe .Name {
246253 chaosresult .ProbeDetails [index ].IsProbeFailedWithError = err
254+ chaosresult .ProbeDetails [index ].HasProbeCompleted = true
247255 chaosresult .ProbeDetails [index ].Status .Description = getDescription (err )
248256 log .Errorf ("The %v http probe has been Failed, err: %v" , probe .Name , err )
249257 isExperimentFailed = true
@@ -395,6 +403,7 @@ loop:
395403 for index := range chaosresult .ProbeDetails {
396404 if chaosresult .ProbeDetails [index ].Name == probe .Name {
397405 chaosresult .ProbeDetails [index ].IsProbeFailedWithError = err
406+ chaosresult .ProbeDetails [index ].HasProbeCompleted = true
398407 chaosresult .ProbeDetails [index ].Status .Description = getDescription (err )
399408 isExperimentFailed = true
400409 break loop
0 commit comments