Skip to content

Commit ce17a0c

Browse files
committed
Address a few more nits
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
1 parent 8c177a6 commit ce17a0c

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

pkg/http/http.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,31 +206,31 @@ func NewClient(logger log.Logger, cfg EndpointsConfig, client *http.Client, prov
206206
}
207207

208208
// Do executes an HTTP request with the underlying HTTP client.
209-
func (f *Client) Do(req *http.Request) (*http.Response, error) {
210-
return f.httpClient.Do(req)
209+
func (c *Client) Do(req *http.Request) (*http.Response, error) {
210+
return c.httpClient.Do(req)
211211
}
212212

213213
// Endpoints returns the list of known endpoints.
214-
func (f *Client) Endpoints() []*url.URL {
214+
func (c *Client) Endpoints() []*url.URL {
215215
var urls []*url.URL
216-
for _, addr := range f.provider.Addresses() {
216+
for _, addr := range c.provider.Addresses() {
217217
urls = append(urls,
218218
&url.URL{
219-
Scheme: f.scheme,
219+
Scheme: c.scheme,
220220
Host: addr,
221-
Path: path.Join("/", f.prefix),
221+
Path: path.Join("/", c.prefix),
222222
},
223223
)
224224
}
225225
return urls
226226
}
227227

228228
// Discover runs the service to discover endpoints until the given context is done.
229-
func (f *Client) Discover(ctx context.Context) {
229+
func (c *Client) Discover(ctx context.Context) {
230230
var wg sync.WaitGroup
231231
ch := make(chan []*targetgroup.Group)
232232

233-
for _, d := range f.fileDiscoverers {
233+
for _, d := range c.fileDiscoverers {
234234
wg.Add(1)
235235
go func(d *file.Discovery) {
236236
d.Run(ctx, ch)
@@ -246,7 +246,7 @@ func (f *Client) Discover(ctx context.Context) {
246246
if update == nil {
247247
continue
248248
}
249-
f.fileSDCache.Update(update)
249+
c.fileSDCache.Update(update)
250250
case <-ctx.Done():
251251
return
252252
}
@@ -256,6 +256,6 @@ func (f *Client) Discover(ctx context.Context) {
256256
}
257257

258258
// Resolve refreshes and resolves the list of targets.
259-
func (f *Client) Resolve(ctx context.Context) {
260-
f.provider.Resolve(ctx, append(f.fileSDCache.Addresses(), f.staticAddresses...))
259+
func (c *Client) Resolve(ctx context.Context) {
260+
c.provider.Resolve(ctx, append(c.fileSDCache.Addresses(), c.staticAddresses...))
261261
}

test/e2e/rule_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,13 @@ func serializeAlertingConfiguration(t *testing.T, cfg ...alert.AlertmanagerConfi
9797
Alertmanagers: cfg,
9898
}
9999
b, err := yaml.Marshal(&amCfg)
100-
if err != nil {
101-
t.Errorf("failed to serialize alerting configuration: %v", err)
102-
}
103-
return b
100+
testutil.Ok(t, err)
104101
}
105102

106103
func serializeQueryConfiguration(t *testing.T, cfg ...query.Config) []byte {
107104
t.Helper()
108105
b, err := yaml.Marshal(&cfg)
109-
if err != nil {
110-
t.Errorf("failed to serialize query configuration: %v", err)
111-
}
106+
testutil.Ok(t, err)
112107
return b
113108
}
114109

0 commit comments

Comments
 (0)