cli: websteps: fix DNSDo (#447)
This fixes an inattention bug in the websteps code.
This commit is contained in:
parent
394bf26313
commit
a9014e7950
|
@ -11,7 +11,7 @@ import (
|
||||||
// Control performs the control request and returns the response.
|
// Control performs the control request and returns the response.
|
||||||
func Control(
|
func Control(
|
||||||
ctx context.Context, sess model.ExperimentSession,
|
ctx context.Context, sess model.ExperimentSession,
|
||||||
thAddr string, creq CtrlRequest) (out CtrlResponse, err error) {
|
thAddr string, resourcePath string, creq CtrlRequest) (out CtrlResponse, err error) {
|
||||||
clnt := httpx.Client{
|
clnt := httpx.Client{
|
||||||
BaseURL: thAddr,
|
BaseURL: thAddr,
|
||||||
HTTPClient: sess.DefaultHTTPClient(),
|
HTTPClient: sess.DefaultHTTPClient(),
|
||||||
|
@ -19,7 +19,7 @@ func Control(
|
||||||
}
|
}
|
||||||
// make sure error is wrapped
|
// make sure error is wrapped
|
||||||
err = errorsx.SafeErrWrapperBuilder{
|
err = errorsx.SafeErrWrapperBuilder{
|
||||||
Error: clnt.PostJSON(ctx, "/", creq, &out),
|
Error: clnt.PostJSON(ctx, resourcePath, creq, &out),
|
||||||
Operation: errorsx.TopLevelOperation,
|
Operation: errorsx.TopLevelOperation,
|
||||||
}.MaybeBuild()
|
}.MaybeBuild()
|
||||||
return
|
return
|
||||||
|
|
|
@ -20,8 +20,8 @@ func DNSDo(ctx context.Context, config DNSConfig) ([]string, error) {
|
||||||
if resolver == nil {
|
if resolver == nil {
|
||||||
childResolver, err := netx.NewDNSClient(netx.Config{Logger: log.Log}, "doh://google")
|
childResolver, err := netx.NewDNSClient(netx.Config{Logger: log.Log}, "doh://google")
|
||||||
runtimex.PanicOnError(err, "NewDNSClient failed")
|
runtimex.PanicOnError(err, "NewDNSClient failed")
|
||||||
var resolver netxlite.Resolver = childResolver
|
resolver = childResolver
|
||||||
resolver = &netxlite.ResolverIDNA{Resolver: resolver}
|
resolver = &netxlite.ResolverIDNA{Resolver: resolver}
|
||||||
}
|
}
|
||||||
return config.Resolver.LookupHost(ctx, config.Domain)
|
return resolver.LookupHost(ctx, config.Domain)
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,7 @@ func (m Measurer) Run(
|
||||||
addrs, err := DNSDo(ctx, DNSConfig{Domain: URL.Hostname()})
|
addrs, err := DNSDo(ctx, DNSConfig{Domain: URL.Hostname()})
|
||||||
endpoints := makeEndpoints(addrs, URL)
|
endpoints := makeEndpoints(addrs, URL)
|
||||||
// 3. Find the testhelper
|
// 3. Find the testhelper
|
||||||
|
// TODO(kelmenhorst,bassosimone): this is not used at the moment, but the hardcoded local address
|
||||||
testhelpers, _ := sess.GetTestHelpersByName("web-connectivity")
|
testhelpers, _ := sess.GetTestHelpersByName("web-connectivity")
|
||||||
var testhelper *model.Service
|
var testhelper *model.Service
|
||||||
for _, th := range testhelpers {
|
for _, th := range testhelpers {
|
||||||
|
@ -125,7 +126,8 @@ func (m Measurer) Run(
|
||||||
"backend": testhelper,
|
"backend": testhelper,
|
||||||
}
|
}
|
||||||
// 4. Query the testhelper
|
// 4. Query the testhelper
|
||||||
resp, err := Control(ctx, sess, testhelper.Address, CtrlRequest{
|
// TODO(kelmenhorst,bassosimone): remove hardcoded version here, this is only for testing purposes
|
||||||
|
resp, err := Control(ctx, sess, "http://localhost:8080", "/api/unstable/websteps", CtrlRequest{
|
||||||
URL: URL.String(),
|
URL: URL.String(),
|
||||||
Headers: map[string][]string{
|
Headers: map[string][]string{
|
||||||
"Accept": {httpheader.Accept()},
|
"Accept": {httpheader.Accept()},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user