mirror of https://github.com/prometheus/prometheus
Merge pull request #1994 from prometheus/grobie/fix-small-issues
Fix low hanging code issuespull/1996/head
commit
4f7e6e8bf0
|
@ -241,7 +241,7 @@ func reloadConfig(filename string, rls ...Reloadable) (err error) {
|
|||
}
|
||||
}
|
||||
if failed {
|
||||
return fmt.Errorf("one or more errors occured while applying the new configuration (-config.file=%s)", filename)
|
||||
return fmt.Errorf("one or more errors occurred while applying the new configuration (-config.file=%s)", filename)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -191,12 +191,12 @@ func TestHandlerRelabel(t *testing.T) {
|
|||
h := New(&Options{
|
||||
QueueCapacity: 3 * maxBatchSize,
|
||||
RelabelConfigs: []*config.RelabelConfig{
|
||||
&config.RelabelConfig{
|
||||
{
|
||||
SourceLabels: model.LabelNames{"alertname"},
|
||||
Action: "drop",
|
||||
Regex: config.MustNewRegexp("drop"),
|
||||
},
|
||||
&config.RelabelConfig{
|
||||
{
|
||||
SourceLabels: model.LabelNames{"alertname"},
|
||||
TargetLabel: "alertname",
|
||||
Action: "replace",
|
||||
|
@ -221,7 +221,7 @@ func TestHandlerRelabel(t *testing.T) {
|
|||
})
|
||||
|
||||
expected := []*model.Alert{
|
||||
&model.Alert{
|
||||
{
|
||||
Labels: model.LabelSet{
|
||||
"alertname": "renamed",
|
||||
},
|
||||
|
|
|
@ -48,7 +48,7 @@ func (e *ParseErr) Error() string {
|
|||
return fmt.Sprintf("parse error at line %d, char %d: %s", e.Line, e.Pos, e.Err)
|
||||
}
|
||||
|
||||
// ParseStmts parses the input and returns the resulting statements or any occuring error.
|
||||
// ParseStmts parses the input and returns the resulting statements or any occurring error.
|
||||
func ParseStmts(input string) (Statements, error) {
|
||||
p := newParser(input)
|
||||
|
||||
|
|
|
@ -1366,9 +1366,9 @@ var testExpr = []struct {
|
|||
fail: true,
|
||||
errMsg: "expected type vector in call to function \"floor\", got scalar",
|
||||
}, {
|
||||
input: "non_existant_function_far_bar()",
|
||||
input: "non_existent_function_far_bar()",
|
||||
fail: true,
|
||||
errMsg: "unknown function with name \"non_existant_function_far_bar\"",
|
||||
errMsg: "unknown function with name \"non_existent_function_far_bar\"",
|
||||
}, {
|
||||
input: "rate(some_metric)",
|
||||
fail: true,
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestMain(m *testing.M) {
|
|||
}
|
||||
|
||||
var portsA = []ContainerPort{
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "http",
|
||||
ContainerPort: 80,
|
||||
Protocol: "TCP",
|
||||
|
@ -37,7 +37,7 @@ var portsA = []ContainerPort{
|
|||
}
|
||||
|
||||
var portsB = []ContainerPort{
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "https",
|
||||
ContainerPort: 443,
|
||||
Protocol: "TCP",
|
||||
|
@ -45,7 +45,7 @@ var portsB = []ContainerPort{
|
|||
}
|
||||
|
||||
var portsNoTcp = []ContainerPort{
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "dns",
|
||||
ContainerPort: 53,
|
||||
Protocol: "UDP",
|
||||
|
@ -53,12 +53,12 @@ var portsNoTcp = []ContainerPort{
|
|||
}
|
||||
|
||||
var portsMultiA = []ContainerPort{
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "http",
|
||||
ContainerPort: 80,
|
||||
Protocol: "TCP",
|
||||
},
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "ssh",
|
||||
ContainerPort: 22,
|
||||
Protocol: "TCP",
|
||||
|
@ -66,12 +66,12 @@ var portsMultiA = []ContainerPort{
|
|||
}
|
||||
|
||||
var portsMultiB = []ContainerPort{
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "http",
|
||||
ContainerPort: 80,
|
||||
Protocol: "TCP",
|
||||
},
|
||||
ContainerPort{
|
||||
{
|
||||
Name: "https",
|
||||
ContainerPort: 443,
|
||||
Protocol: "TCP",
|
||||
|
@ -112,7 +112,7 @@ func pod(name string, containers []Container) *Pod {
|
|||
PodIP: "1.1.1.1",
|
||||
Phase: "Running",
|
||||
Conditions: []PodCondition{
|
||||
PodCondition{
|
||||
{
|
||||
Type: "Ready",
|
||||
Status: "True",
|
||||
},
|
||||
|
|
|
@ -137,7 +137,7 @@ func TestScrapePoolReload(t *testing.T) {
|
|||
ScrapeInterval: model.Duration(3 * time.Second),
|
||||
ScrapeTimeout: model.Duration(2 * time.Second),
|
||||
}
|
||||
// On starting to run, new loops created on reload check whether their preceeding
|
||||
// On starting to run, new loops created on reload check whether their preceding
|
||||
// equivalents have been stopped.
|
||||
newLoop := func(ctx context.Context, s scraper, app, reportApp storage.SampleAppender) loop {
|
||||
l := &testLoop{}
|
||||
|
@ -163,7 +163,7 @@ func TestScrapePoolReload(t *testing.T) {
|
|||
}
|
||||
|
||||
// Reloading a scrape pool with a new scrape configuration must stop all scrape
|
||||
// loops and start new ones. A new loop must not be started before the preceeding
|
||||
// loops and start new ones. A new loop must not be started before the preceding
|
||||
// one terminated.
|
||||
|
||||
for i := 0; i < numTargets; i++ {
|
||||
|
|
|
@ -122,7 +122,7 @@ func TestTargetURL(t *testing.T) {
|
|||
}
|
||||
|
||||
if u := target.URL(); !reflect.DeepEqual(u.String(), expectedURL.String()) {
|
||||
t.Fatalf("Expected URL %q but got %q", expectedURL, u)
|
||||
t.Fatalf("Expected URL %q, but got %q", expectedURL.String(), u.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,9 @@ func testPersistLoadDropChunks(t *testing.T, encoding chunkEncoding) {
|
|||
}
|
||||
// Load chunk descs partially.
|
||||
actualChunkDescs, err = p.loadChunkDescs(fp, 5)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(actualChunkDescs) != 5 {
|
||||
t.Errorf("Got %d chunkDescs, want %d.", len(actualChunkDescs), 5)
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ func TestMatches(t *testing.T) {
|
|||
matchers: metric.LabelMatchers{
|
||||
newMatcher(metric.Equal, "all", "const"),
|
||||
newMatcher(metric.NotEqual, "label1", "test_0"),
|
||||
newMatcher(metric.Equal, "not_existant", ""),
|
||||
newMatcher(metric.Equal, "not_existent", ""),
|
||||
},
|
||||
expected: fingerprints[10:],
|
||||
},
|
||||
|
|
|
@ -40,7 +40,7 @@ func NewClient(address string, timeout time.Duration) (*Client, error) {
|
|||
// grpc.Dial() returns immediately and doesn't error when the server is
|
||||
// unreachable when not passing in the WithBlock() option. The client then
|
||||
// will continuously try to (re)establish the connection in the background.
|
||||
// So this will only return here if some other uncommon error occured.
|
||||
// So this will only return here if some other uncommon error occurred.
|
||||
return nil, err
|
||||
}
|
||||
return &Client{
|
||||
|
@ -66,7 +66,7 @@ func (c *Client) Store(samples model.Samples) error {
|
|||
})
|
||||
}
|
||||
ts.Samples = []*Sample{
|
||||
&Sample{
|
||||
{
|
||||
Value: float64(s.Value),
|
||||
TimestampMs: int64(s.Timestamp),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue