H-A-374: set a drifted directory the mesh made right at the engine's start
ace's Node toolchain cache directory stood at 0700 against its entry's 0711 while the engine said its composition was unchanged: an unchanged composition is never applied, and the judgement reads the compositions, not the disk. Each module taken as running at the engine's start now has every directory entry its record says the mesh made given its declared owner and mode where they drifted on disk, one journal line each; one the mesh never made stays used as found and is said (issue 339). The verb composition's diff names a drifted directory the mesh made. The agent test that marks modules not composed now waits for every want it marks. Builds: design 47 H2 §813; H-A-374, H-A-392
This commit is contained in:
@@ -133,6 +133,8 @@ type bed struct {
|
||||
said []string
|
||||
// settled is each module Settled was told, and settledRan whether what runs held it then.
|
||||
settled []string
|
||||
// takenAtStart is each module TakenAtStart was told, with its composition's resource count.
|
||||
takenAtStart []string
|
||||
settledRan []bool
|
||||
ag *Agent // the agent run() runs
|
||||
env Env
|
||||
@@ -179,6 +181,11 @@ func newBed(t *testing.T) *bed {
|
||||
}
|
||||
return Backup{Done: true}
|
||||
},
|
||||
TakenAtStart: func(m string, runs compositions.Composed) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
b.takenAtStart = append(b.takenAtStart, fmt.Sprintf("%s:%d", m, len(runs.Resources)))
|
||||
},
|
||||
Settled: func(m string) {
|
||||
ran := false
|
||||
if b.ag != nil {
|
||||
@@ -420,6 +427,11 @@ func TestStartingOnWhatTheKeptDeclarationHoldsAppliesNothing(t *testing.T) {
|
||||
if got := b.appliedList(); len(got) != 0 {
|
||||
t.Fatalf("a module that already runs what the want names was applied: %v", got)
|
||||
}
|
||||
// H-A-392: a module taken as running at the start is told with the composition it runs, for its directories' drift.
|
||||
if b.mu.Lock(); !slices.Equal(b.takenAtStart, []string{"web:2"}) {
|
||||
t.Errorf("taken at the start were %v; want web with its two resources", b.takenAtStart)
|
||||
}
|
||||
b.mu.Unlock()
|
||||
t.Run("starting on its own have applies nothing", testStartingOnItsOwnHaveAppliesNothing)
|
||||
}
|
||||
|
||||
@@ -1907,10 +1919,11 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
|
||||
b.haves.Write(context.Background(), Have{Module: "broken", FP: brokenFP, Composed: brokenDig, Phase: string(nodeengineclient.PhaseFailed),
|
||||
Detail: "apply: unit failed to start"})
|
||||
want("broken", brokenFP, "")
|
||||
eventually(t, "unread's want was not taken", func() bool {
|
||||
// Every want taken before the mark, not unread's alone: fresh's taken after it was not marked (seen under -race).
|
||||
eventually(t, "the wants were not taken", func() bool {
|
||||
b.ag.mu.Lock()
|
||||
defer b.ag.mu.Unlock()
|
||||
return b.ag.wants["unread"].Present
|
||||
return b.ag.wants["unread"].Present && b.ag.wants["fresh"].Present && b.ag.wants["broken"].Present
|
||||
})
|
||||
b.ag.NotComposed(context.Background(), "a stand-in for web's password, again")
|
||||
if h := b.haves.last("unread"); h.Module != "" {
|
||||
@@ -1992,7 +2005,14 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
|
||||
// container it recreates; the revision that runs, asked by its digest, is no move (issue 774).
|
||||
keep(dk, draw)
|
||||
keep(dk, drawMoved)
|
||||
// H-A-392: and with diff, each directory the mesh made of what runs whose mode or owner on disk drifted.
|
||||
b.ag.env.DirectoryDrift = func(runs compositions.Composed) []DriftView {
|
||||
return []DriftView{{ID: runs.Module + ".data", Path: "/srv/db", Drift: "mode 0700, 0711 declared"}}
|
||||
}
|
||||
view, err := b.ag.Composition(context.Background(), "db", "", true)
|
||||
if len(view.Drift) != 1 || view.Drift[0].ID != "db.data" {
|
||||
t.Errorf("the diff of db names the drift %+v", view.Drift)
|
||||
}
|
||||
if err != nil || view.Have == nil || view.Have.Phase != string(nodeengineclient.PhaseWaitingYes) || view.Composition.Digest != ddigMoved ||
|
||||
view.Runs == nil || view.Runs.Composed != ddig || view.Judged.Judgement != string(nodeengineclient.JudgedRecreates) ||
|
||||
!view.Judged.WaitsForYes || len(view.Diff) != 1 || view.Diff[0].ID != "db.server" || view.Diff[0].Change != "changed" ||
|
||||
|
||||
Reference in New Issue
Block a user