fix: strict flag values, MI NULL properties and container without HCS (#2553)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-08 19:43:38 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent b6d75ffb71
commit f8ada403f2
9 changed files with 176 additions and 3 deletions
+4 -1
View File
@@ -274,7 +274,10 @@ func (c *Collection) Build(ctx context.Context, logger *slog.Logger) error {
err := fmt.Errorf("error build collector %s: %w", result.name, result.err)
if errors.Is(err, pdh.ErrNoData) ||
// errors.ErrUnsupported marks a collector whose subsystem is not
// available on this host, e.g. a Windows feature that is not installed.
if errors.Is(err, errors.ErrUnsupported) ||
errors.Is(err, pdh.ErrNoData) ||
errors.Is(err, winregistry.ErrNotExist) ||
errors.Is(err, pdh.NewPdhError(pdh.CstatusNoObject)) ||
errors.Is(err, pdh.NewPdhError(pdh.CstatusNoCounter)) ||
+2
View File
@@ -19,6 +19,7 @@ package collector_test
import (
"errors"
"fmt"
"log/slog"
"testing"
"time"
@@ -69,6 +70,7 @@ func TestCollectionBuildAndClose(t *testing.T) {
{name: "success"},
{name: "build failure", buildErr: buildFailure, wantBuildErr: buildFailure},
{name: "optional counter missing", buildErr: pdh.ErrNoData},
{name: "unsupported on this host", buildErr: fmt.Errorf("feature missing: %w", errors.ErrUnsupported)},
{name: "close failure", closeErr: closeFailure},
} {
t.Run(tc.name, func(t *testing.T) {