fix scraper id

pull/10616/head
Kelvin Wang 2018-10-11 22:57:09 -04:00 committed by Leonardo Di Donato
parent b4e1cd4199
commit 27b2715264
3 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"path"
@ -217,6 +218,9 @@ func (s *ScraperService) ListTargets(ctx context.Context) ([]platform.ScraperTar
// UpdateTarget updates a single scraper target with changeset.
// Returns the new target state after update.
func (s *ScraperService) UpdateTarget(ctx context.Context, update *platform.ScraperTarget) (*platform.ScraperTarget, error) {
if !update.ID.Valid() {
return nil, errors.New("update scraper: id is invalid")
}
url, err := newURL(s.Addr, targetIDPath(update.ID))
if err != nil {
return nil, err

View File

@ -33,8 +33,6 @@ func initScraperService(f platformtesting.TargetFields, t *testing.T) (platform.
return &client, done
}
/*
func TestScraperService(t *testing.T) {
platformtesting.ScraperService(initScraperService, t)
}
*/

View File

@ -138,6 +138,7 @@ func AddTarget(
},
args: args{
target: &platform.ScraperTarget{
ID: MustIDBase16(targetTwoID),
Name: "name2",
Type: platform.PrometheusScraperType,
OrgName: "org2",