Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate whole plan, rather than topmost two layers #363

Merged
merged 15 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internals/overlord/servstate/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ func (m *ServiceManager) updatePlanLayers(layers []*plan.Layer) error {
Checks: combined.Checks,
LogTargets: combined.LogTargets,
}
err = p.Validate()
if err != nil {
return err
}
m.updatePlan(p)
return nil
}
Expand Down
16 changes: 16 additions & 0 deletions internals/overlord/servstate/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,18 @@ services:
command: /bin/b
`[1:])
s.planLayersHasLen(c, s.manager, 3)

// Make sure that layer validation is happening.
layer = parseLayer(c, 0, "label4", `
checks:
bad-check:
override: replace
level: invalid
tcp:
port: 8080
`)
err = s.manager.CombineLayer(layer)
c.Check(err, ErrorMatches, `(?s).*plan check.*must be "alive" or "ready".*`)
}

func (s *S) TestSetServiceArgs(c *C) {
Expand Down Expand Up @@ -1031,6 +1043,7 @@ checks:
chk1:
override: replace
period: 100ms
timeout: 90ms
tonyandrewmeyer marked this conversation as resolved.
Show resolved Hide resolved
threshold: 1
exec:
command: will-fail
Expand Down Expand Up @@ -1126,6 +1139,7 @@ checks:
chk1:
override: replace
period: 100ms
timeout: 90ms
threshold: 1
exec:
command: will-fail
Expand Down Expand Up @@ -1213,6 +1227,7 @@ checks:
chk1:
override: replace
period: 100ms
timeout: 90ms
threshold: 1
exec:
command: will-fail
Expand Down Expand Up @@ -1297,6 +1312,7 @@ checks:
chk1:
override: replace
period: 100ms
timeout: 90ms
threshold: 1
exec:
command: will-fail
Expand Down
Loading
Loading