diff --git a/cmd/promtool/rules_test.go b/cmd/promtool/rules_test.go index ac326841f..4afae2c9f 100644 --- a/cmd/promtool/rules_test.go +++ b/cmd/promtool/rules_test.go @@ -91,7 +91,7 @@ func TestBackfillRuleIntegration(t *testing.T) { group1 := ruleImporter.groups[path1+";group0"] require.NotNil(t, group1) const defaultInterval = 60 - require.Equal(t, time.Duration(defaultInterval*time.Second), group1.Interval()) + require.Equal(t, defaultInterval*time.Second, group1.Interval()) gRules := group1.Rules() require.Equal(t, 1, len(gRules)) require.Equal(t, "rule1", gRules[0].Name()) @@ -100,7 +100,7 @@ func TestBackfillRuleIntegration(t *testing.T) { group2 := ruleImporter.groups[path2+";group2"] require.NotNil(t, group2) - require.Equal(t, time.Duration(defaultInterval*time.Second), group2.Interval()) + require.Equal(t, defaultInterval*time.Second, group2.Interval()) g2Rules := group2.Rules() require.Equal(t, 2, len(g2Rules)) require.Equal(t, "grp2_rule1", g2Rules[0].Name()) diff --git a/cmd/promtool/unittest.go b/cmd/promtool/unittest.go index e06c6c861..3ddec3152 100644 --- a/cmd/promtool/unittest.go +++ b/cmd/promtool/unittest.go @@ -255,7 +255,7 @@ func (tg *testGroup) test(evalInterval time.Duration, groupOrderMap map[string]i for { if !(curr < len(alertEvalTimes) && ts.Sub(mint) <= time.Duration(alertEvalTimes[curr]) && - time.Duration(alertEvalTimes[curr]) < ts.Add(time.Duration(evalInterval)).Sub(mint)) { + time.Duration(alertEvalTimes[curr]) < ts.Add(evalInterval).Sub(mint)) { break } diff --git a/discovery/consul/consul.go b/discovery/consul/consul.go index 3416d86d6..19dc9ecca 100644 --- a/discovery/consul/consul.go +++ b/discovery/consul/consul.go @@ -199,7 +199,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { logger = log.NewNopLogger() } - wrapper, err := config.NewClientFromConfig(conf.HTTPClientConfig, "consul_sd", config.WithHTTP2Disabled(), config.WithIdleConnTimeout(2*time.Duration(watchTimeout))) + wrapper, err := config.NewClientFromConfig(conf.HTTPClientConfig, "consul_sd", config.WithHTTP2Disabled(), config.WithIdleConnTimeout(2*watchTimeout)) if err != nil { return nil, err } diff --git a/storage/remote/queue_manager_test.go b/storage/remote/queue_manager_test.go index fe976fc1b..ccca000df 100644 --- a/storage/remote/queue_manager_test.go +++ b/storage/remote/queue_manager_test.go @@ -295,10 +295,10 @@ func TestShutdown(t *testing.T) { // be at least equal to deadline, otherwise the flush deadline // was not respected. duration := time.Since(start) - if duration > time.Duration(deadline+(deadline/10)) { + if duration > deadline+(deadline/10) { t.Errorf("Took too long to shutdown: %s > %s", duration, deadline) } - if duration < time.Duration(deadline) { + if duration < deadline { t.Errorf("Shutdown occurred before flush deadline: %s < %s", duration, deadline) } }