systemd-resolved: checkUnknownPaths knows exactly its own files (review r2 (4))
It treated the verb's own uplink-names.new as unknown and accepted any bare *.tmp; it now knows exactly uplink-names, uplink-names.new, uplink-names.applied and uplink-names.applied.tmp, as §6 and §8 name them, and nothing else. Builds: design 08 sign-in-page §6, §8, C-7
This commit is contained in:
@@ -364,6 +364,28 @@ func TestAnUnknownPathIsLeftAndJournalledOnce(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The verb's own uplink-names.new and the guard's own uplink-names.applied.tmp are this module's, never
|
||||
// said as unknown (design 08 sign-in-page §6, §8; review r2 (4)).
|
||||
func TestItsOwnTemporaryFilesAreNeverSaidUnknown(t *testing.T) {
|
||||
g, _, _, r := aGuardedMachineWithLinks(t, "wlan0")
|
||||
// A directory of its own: /var/lib/node-resolver holds nothing but this module's files, unlike the
|
||||
// fixture's shared one, which also keeps net/ and suffix for the Resolver's other paths.
|
||||
dir := t.TempDir()
|
||||
r.UplinkNamesFile = filepath.Join(dir, "uplink-names")
|
||||
r.UplinkNamesAppliedFile = filepath.Join(dir, "uplink-names.applied")
|
||||
for _, name := range []string{r.UplinkNamesFile + ".new", r.UplinkNamesAppliedFile + ".tmp"} {
|
||||
if err := os.WriteFile(name, []byte(""), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
var said []string
|
||||
g.Log = func(format string, a ...any) { said = append(said, fmt.Sprintf(format, a...)) }
|
||||
g.checkUnknownPaths()
|
||||
if len(said) != 0 {
|
||||
t.Errorf("said %v, want nothing for this module's own files", said)
|
||||
}
|
||||
}
|
||||
|
||||
// A changed list replaces the old one on the link, the route itself staying put (design 08 sign-in-page §9).
|
||||
func TestAChangedListReplacesTheOldOneOnTheLink(t *testing.T) {
|
||||
g, _, f, r := aGuardedMachineWithLinks(t, "wlan0")
|
||||
|
||||
Reference in New Issue
Block a user