cleanup: use ErrorToStringOrOK func in other tests that returns nil (#701)
Reference issue: https://github.com/ooni/probe/issues/2040
This commit is contained in:
parent
024eb42334
commit
74e31d5cc1
|
@ -131,7 +131,7 @@ func (m Measurer) Run(
|
||||||
tk.Tampering = (tk.Tampering || result.Tampering)
|
tk.Tampering = (tk.Tampering || result.Tampering)
|
||||||
completed++
|
completed++
|
||||||
percentage := (float64(completed)/float64(len(m.Methods)))*0.5 + 0.5
|
percentage := (float64(completed)/float64(len(m.Methods)))*0.5 + 0.5
|
||||||
callbacks.OnProgress(percentage, fmt.Sprintf("%s... %+v", result.Name, result.Err))
|
callbacks.OnProgress(percentage, fmt.Sprintf("%s... %+v", result.Name, model.ErrorToStringOrOK(result.Err)))
|
||||||
if completed >= len(m.Methods) {
|
if completed >= len(m.Methods) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (m Multi) collect(expect int, overallStartIndex int, overallCount int, pref
|
||||||
count++
|
count++
|
||||||
percentage := float64(count) / float64(overallCount)
|
percentage := float64(count) / float64(overallCount)
|
||||||
callbacks.OnProgress(percentage, fmt.Sprintf(
|
callbacks.OnProgress(percentage, fmt.Sprintf(
|
||||||
"%s: measure %s: %+v", prefix, entry.Input.Target, entry.Err,
|
"%s: measure %s: %+v", prefix, entry.Input.Target, model.ErrorToStringOrOK(entry.Err),
|
||||||
))
|
))
|
||||||
outputch <- entry
|
outputch <- entry
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ func Control(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = netxlite.NewTopLevelGenericErrWrapper(err)
|
err = netxlite.NewTopLevelGenericErrWrapper(err)
|
||||||
}
|
}
|
||||||
sess.Logger().Infof("control for %s... %+v", creq.HTTPRequest, err)
|
sess.Logger().Infof("control for %s... %+v", creq.HTTPRequest, model.ErrorToStringOrOK(err))
|
||||||
(&out.DNS).FillASNs(sess)
|
(&out.DNS).FillASNs(sess)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func DNSLookup(ctx context.Context, config DNSLookupConfig) (out DNSLookupResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config.Session.Logger().Infof("%s... %+v", target, err)
|
config.Session.Logger().Infof("%s... %+v", target, model.ErrorToStringOrOK(err))
|
||||||
out.Failure = result.Failure
|
out.Failure = result.Failure
|
||||||
out.TestKeys = result
|
out.TestKeys = result
|
||||||
return
|
return
|
||||||
|
|
|
@ -63,7 +63,7 @@ func HTTPGet(ctx context.Context, config HTTPGetConfig) (out HTTPGetResult) {
|
||||||
Session: config.Session,
|
Session: config.Session,
|
||||||
Target: target,
|
Target: target,
|
||||||
}.Get(ctx)
|
}.Get(ctx)
|
||||||
config.Session.Logger().Infof("GET %s... %+v", target, err)
|
config.Session.Logger().Infof("GET %s... %+v", target, model.ErrorToStringOrOK(err))
|
||||||
out.Failure = result.Failure
|
out.Failure = result.Failure
|
||||||
out.TestKeys = result
|
out.TestKeys = result
|
||||||
return
|
return
|
||||||
|
|
|
@ -163,7 +163,7 @@ func (r *Resolver) lookupHost(ctx context.Context, ri *resolverinfo, hostname st
|
||||||
}
|
}
|
||||||
addrs, err := r.timeLimitedLookup(ctx, re, hostname)
|
addrs, err := r.timeLimitedLookup(ctx, re, hostname)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
r.logger().Infof("sessionresolver: %s... %v", ri.URL, nil)
|
r.logger().Infof("sessionresolver: %s... %v", ri.URL, model.ErrorToStringOrOK(nil))
|
||||||
ri.Score = ewma*1.0 + (1-ewma)*ri.Score // increase score
|
ri.Score = ewma*1.0 + (1-ewma)*ri.Score // increase score
|
||||||
return addrs, nil
|
return addrs, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user