Reload the service manager's units before restarting a service whose files changed, and start the guard before the network as the controller declares it (hq ADR 0100)
This commit is contained in:
@@ -1114,6 +1114,18 @@ func TestAServiceIsRestartedWhenWhatItReflectsChanges(t *testing.T) {
|
||||
if !stopped || !started {
|
||||
t.Errorf("the file changed and the service was not restarted; commands were %v", commands)
|
||||
}
|
||||
reloaded, stop := -1, -1
|
||||
for i, c := range commands {
|
||||
if strings.Contains(c, "daemon-reload") && reloaded < 0 {
|
||||
reloaded = i
|
||||
}
|
||||
if strings.Contains(c, "stop thing.service") && stop < 0 {
|
||||
stop = i
|
||||
}
|
||||
}
|
||||
if reloaded < 0 || reloaded > stop {
|
||||
t.Errorf("the service was restarted without the unit files being read again first; commands were %v", commands)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user