Skip to content
Snippets Groups Projects
Commit 46e4397e authored by ale's avatar ale
Browse files

Allow HTTP probe steps to have names

To simplify debugging.
parent 6c04a969
No related branches found
No related tags found
No related merge requests found
Pipeline #57807 failed
...@@ -53,9 +53,13 @@ type httpProbe struct { ...@@ -53,9 +53,13 @@ type httpProbe struct {
func (p *httpProbe) RunProbe(ctx context.Context, debug *log.Logger) error { func (p *httpProbe) RunProbe(ctx context.Context, debug *log.Logger) error {
browser := http.NewBrowser(p.tls, debug, p.dnsMap) browser := http.NewBrowser(p.tls, debug, p.dnsMap)
for idx, step := range p.script { for idx, step := range p.script {
debug.Printf("sequence step #%d", idx+1) stepName := fmt.Sprintf("#%d", idx+1)
if step.Name != "" {
stepName = fmt.Sprintf("%s - '%s'", stepName, step.Name)
}
debug.Printf("sequence step %s", stepName)
if err := http.CheckStep(ctx, browser, step, debug); err != nil { if err := http.CheckStep(ctx, browser, step, debug); err != nil {
err = fmt.Errorf("step #%d failed: %w", idx+1, err) err = fmt.Errorf("step %s failed: %w", stepName, err)
debug.Printf("%v", err) debug.Printf("%v", err)
return err return err
} }
......
...@@ -17,6 +17,7 @@ type BasicAuth struct { ...@@ -17,6 +17,7 @@ type BasicAuth struct {
// A Step in a script, a series of HTTP transactions whose results we can // A Step in a script, a series of HTTP transactions whose results we can
// verify somehow (right now just by needle-in-haystack string matching). // verify somehow (right now just by needle-in-haystack string matching).
type Step struct { type Step struct {
Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
URL string `json:"url"` URL string `json:"url"`
Method string `json:"method"` Method string `json:"method"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment