journal refuses a boot argument it does not use (issue 1975, AC4); tests cite their acceptance labels
mesh/delivery-group group fix/1975-kernel-log rejected: composed together: the checker's verdict at the members' heads (c265ee221ccf): unit: distribution/inter…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (2): unit: distribution/internal/holder.TestTheHolderOfTheTwoImageSeats/a_transfer_in_par…; and 1 more | ebcc7761f178 on d9f2b7bcfa07
mesh/delivery-group group fix/1975-kernel-log rejected: composed together: the checker's verdict at the members' heads (c265ee221ccf): unit: distribution/inter…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (2): unit: distribution/internal/holder.TestTheHolderOfTheTwoImageSeats/a_transfer_in_par…; and 1 more | ebcc7761f178 on d9f2b7bcfa07
Builds: issue 1975 note 2: lead answer L4, acceptance 1975/AC1-AC4 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -319,6 +319,9 @@ func (m *Manager) Journal(scope Scope, unit string, q JournalQuery) (map[string]
|
||||
if err := unitArg(unit); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if q.Boot != "" {
|
||||
return nil, fmt.Errorf("boot %q: the journal of a unit is not read by boot; kernel-log takes a boot", q.Boot)
|
||||
}
|
||||
q, err := q.valid()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -242,7 +242,7 @@ func TestFailedIsOnTheSeatAndNarrowsToAScope(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The kernel-log verb (issue 1975): the kernel's messages of one boot, in the journal verb's window, priority,
|
||||
// 1975/AC1: kernel-log reads journalctl --dmesg --boot=N under journal's escalation (issue 1975): the kernel's messages of one boot, in the journal verb's window, priority,
|
||||
// match, cap and redaction, and a boot named 0, -1, and so on.
|
||||
func TestTheKernelLogIsOneBootsMessagesInTheJournalsForms(t *testing.T) {
|
||||
var calls []call
|
||||
@@ -274,6 +274,7 @@ func TestTheKernelLogIsOneBootsMessagesInTheJournalsForms(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1975/AC2: a boot that is not 0 to -9999 is refused and no command runs.
|
||||
func TestAKernelLogBootIsRefusedBeforeAnythingRunsUnlessItIsZeroOrBefore(t *testing.T) {
|
||||
for _, bad := range []string{"1", "abc", "--user", "-1 --merge", "-10000", "0x1", "-1;id"} {
|
||||
var calls []call
|
||||
@@ -287,6 +288,7 @@ func TestAKernelLogBootIsRefusedBeforeAnythingRunsUnlessItIsZeroOrBefore(t *test
|
||||
}
|
||||
}
|
||||
|
||||
// 1975/AC3: the window, priority, match, 2000-line cap and redaction are journal's.
|
||||
func TestTheKernelLogKeepsTheCapTheMatchAndTheRedaction(t *testing.T) {
|
||||
var calls []call
|
||||
m := journalOf([]string{"k one", "k password=hunter2secretvalue here", "k two"}, "", &calls)
|
||||
@@ -313,3 +315,15 @@ func TestTheKernelLogKeepsTheCapTheMatchAndTheRedaction(t *testing.T) {
|
||||
t.Errorf("a secret in a kernel line was answered: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// 1975/AC4: journal refuses a boot argument it does not use, never reading this boot quietly.
|
||||
func TestJournalRefusesABootArgument(t *testing.T) {
|
||||
var calls []call
|
||||
m := journalOf([]string{"a"}, "", &calls)
|
||||
if _, err := m.Journal(System, "mail.service", JournalQuery{Boot: "-1"}); err == nil {
|
||||
t.Fatal("journal accepted a boot and read this boot")
|
||||
}
|
||||
if len(calls) != 0 {
|
||||
t.Fatalf("a refused boot reached the manager: %v", calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user