fix: complete target diagnostics and reset inspection

This commit is contained in:
proxyctl coordinator
2026-07-17 10:29:41 +08:00
parent f6c6ead325
commit 0fbaa71e37
14 changed files with 366 additions and 10 deletions
@@ -44,6 +44,29 @@ func TestAvailabilityAndDescriptionDescribeOnlyDockerClientDefaults(t *testing.T
}
}
func TestDiagnosticChecksCoverSchemaAndAuthorityWithoutMutation(t *testing.T) {
files := &countingFS{FileSystem: dockerclient.OSFileSystem{}}
a := newAdapterWithFS(t, files)
checks := a.DiagnosticChecks(context.Background(), activeProfile())
for _, name := range []string{"required commands", "configuration schema", "write authority"} {
found := false
for _, check := range checks {
found = found || check.Name == name
}
if !found {
t.Errorf("diagnostics missing %q: %#v", name, checks)
}
}
if files.writes != 0 {
t.Fatalf("diagnostics wrote Docker client state %d times", files.writes)
}
for _, path := range []string{a.ConfigPath(), a.RecoveryPath(), a.LockPath()} {
if _, err := os.Stat(path); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("diagnostics created %s: %v", path, err)
}
}
}
func TestDockerClientAdapterRunsReusableTargetContract(t *testing.T) {
targettest.Run(t, func(t *testing.T) targettest.Fixture {
a := newAdapter(t, nil)