1
0
Fork 0
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:
Sebastiaan van Stijn 2020-10-05 20:04:52 +02:00
parent 2b8e68ef06
commit 561b8014c0
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 9 additions and 0 deletions

View file

@ -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)

View file

@ -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
}
}