mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-07 19:16:36 +00:00
chore: added tests (#1800)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -47,7 +47,10 @@ var ConfigDefaults = Config{
|
||||
scrapeInterval: 6 * time.Hour,
|
||||
}
|
||||
|
||||
var ErrNoUpdates = errors.New("pending gather update metrics")
|
||||
var (
|
||||
ErrNoUpdates = errors.New("pending gather update metrics")
|
||||
ErrUpdateServiceDisabled = errors.New("windows updates service is disabled")
|
||||
)
|
||||
|
||||
type Collector struct {
|
||||
config Config
|
||||
@@ -234,7 +237,7 @@ func (c *Collector) scheduleUpdateStatus(ctx context.Context, logger *slog.Logge
|
||||
}(hc)
|
||||
|
||||
if err != nil {
|
||||
initErrCh <- fmt.Errorf("windows updates service is disabled: %w", err)
|
||||
initErrCh <- ErrUpdateServiceDisabled
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -23,5 +23,9 @@ import (
|
||||
)
|
||||
|
||||
func BenchmarkCollector(b *testing.B) {
|
||||
testutils.FuncBenchmarkCollector(b, "printer", update.NewWithFlags)
|
||||
testutils.FuncBenchmarkCollector(b, update.Name, update.NewWithFlags)
|
||||
}
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
testutils.TestCollector(t, update.New, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user