fix: complete target diagnostics and reset inspection
This commit is contained in:
@@ -102,6 +102,30 @@ func (f *faultFS) AtomicWrite(path string, data []byte, mode os.FileMode) error
|
||||
return f.recordingFS.AtomicWrite(path, data, mode)
|
||||
}
|
||||
|
||||
func TestDiagnosticChecksCoverSystemdSchemaAndAuthorityWithoutMutation(t *testing.T) {
|
||||
a, record, daemonPath, recoveryPath, _ := fixture(t)
|
||||
checks := a.DiagnosticChecks(context.Background(), activeProfile())
|
||||
for _, name := range []string{"required command and service", "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)
|
||||
}
|
||||
}
|
||||
for _, event := range record.events {
|
||||
if strings.HasPrefix(event, "write ") || strings.HasPrefix(event, "remove ") || strings.Contains(event, " restart ") || strings.Contains(event, "daemon-reload") {
|
||||
t.Fatalf("diagnostics mutated daemon state: %#v", record.events)
|
||||
}
|
||||
}
|
||||
for _, path := range []string{daemonPath, recoveryPath} {
|
||||
if _, err := os.Stat(path); !errors.Is(err, os.ErrNotExist) {
|
||||
t.Fatalf("diagnostics created %s: %v", path, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDockerDaemonRunsReusableTargetContract(t *testing.T) {
|
||||
targettest.Run(t, func(t *testing.T) targettest.Fixture {
|
||||
a, _, daemonPath, _, _ := fixture(t)
|
||||
|
||||
Reference in New Issue
Block a user