Skip to content

Commit

Permalink
updates http probe wait duration to ms (#643)
Browse files Browse the repository at this point in the history
Signed-off-by: neelanjan00 <[email protected]>
  • Loading branch information
neelanjan00 authored Mar 8, 2023
1 parent ea2b83e commit 04c031a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/probe/httpprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func httpGet(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
// it contains a timeout per iteration of retry. if the timeout expires without success then it will go to next try
// for a timeout, it will run the command, if it fails wait for the interval and again execute the command until timeout expires
if err := retry.Times(uint(getAttempts(probe.RunProperties.Attempt, probe.RunProperties.Retry))).
Wait(time.Duration(probe.RunProperties.Interval) * time.Second).
Wait(time.Duration(probe.RunProperties.Interval) * time.Millisecond).
Try(func(attempt uint) error {
// getting the response from the given url
resp, err := client.Get(probe.HTTPProbeInputs.URL)
Expand Down Expand Up @@ -152,7 +152,7 @@ func httpPost(probe v1alpha1.ProbeAttributes, client *http.Client, resultDetails
// it contains a timeout per iteration of retry. if the timeout expires without success then it will go to next try
// for a timeout, it will run the command, if it fails wait for the interval and again execute the command until timeout expires
if err := retry.Times(uint(getAttempts(probe.RunProperties.Attempt, probe.RunProperties.Retry))).
Wait(time.Duration(probe.RunProperties.Interval) * time.Second).
Wait(time.Duration(probe.RunProperties.Interval) * time.Millisecond).
Try(func(attempt uint) error {
resp, err := client.Post(probe.HTTPProbeInputs.URL, probe.HTTPProbeInputs.Method.Post.ContentType, strings.NewReader(body))
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions pkg/probe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"bytes"
"context"
"fmt"
"html/template"
"strings"

"github.com/kyokomi/emoji"
"github.com/litmuschaos/chaos-operator/api/litmuschaos/v1alpha1"
"github.com/litmuschaos/litmus-go/pkg/cerrors"
Expand All @@ -12,9 +15,7 @@ import (
"github.com/litmuschaos/litmus-go/pkg/types"
"github.com/palantir/stacktrace"
"github.com/sirupsen/logrus"
"html/template"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strings"
)

var err error
Expand Down Expand Up @@ -223,6 +224,7 @@ func markedVerdictInEnd(err error, resultDetails *types.ResultDetails, probe v1a
return nil
}

// getProbeByName returns the probe details of a probe given its name
func getProbeByName(name string, probeDetails []*types.ProbeDetails) *types.ProbeDetails {
for _, p := range probeDetails {
if p.Name == name {
Expand Down

0 comments on commit 04c031a

Please sign in to comment.