mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
testutil: set -500 OOM score for test daemons
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2b8e68ef06
commit
561b8014c0
2 changed files with 9 additions and 0 deletions
|
@ -88,6 +88,7 @@ type Daemon struct {
|
|||
DefaultAddrPool []string
|
||||
SubnetSize uint32
|
||||
DataPathPort uint32
|
||||
OOMScoreAdjust int
|
||||
// cached information
|
||||
CachedInfo types.Info
|
||||
}
|
||||
|
@ -206,6 +207,7 @@ func New(t testing.TB, ops ...Option) *Daemon {
|
|||
}
|
||||
ops = append(ops, WithRootlessUser("unprivilegeduser"))
|
||||
}
|
||||
ops = append(ops, WithOOMScoreAdjust(-500))
|
||||
|
||||
d, err := NewDaemon(dest, ops...)
|
||||
assert.NilError(t, err, "could not create daemon at %q", dest)
|
||||
|
|
|
@ -115,3 +115,10 @@ func WithRootlessUser(username string) Option {
|
|||
d.rootlessUser = u
|
||||
}
|
||||
}
|
||||
|
||||
// WithOOMScoreAdjust sets OOM score for the daemon
|
||||
func WithOOMScoreAdjust(score int) Option {
|
||||
return func(d *Daemon) {
|
||||
d.OOMScoreAdjust = score
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue