Skip to content

Commit

Permalink
wip: generate: add test for oom score adj
Browse files Browse the repository at this point in the history
The generator should not clear an existing OOMScoreAdj if no adjustment
is performed.

Signed-off-by: Samuel Karp <[email protected]>
  • Loading branch information
samuelkarp committed Oct 23, 2024
1 parent 44ecabb commit e8dd22a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/runtime-tools/generate/generate_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,26 @@ var _ = Describe("Adjustment", func() {
})
})

When("existing oom score adj", func() {
It("does not adjust Spec", func() {
var (
spec = makeSpec()
expectedSpec = makeSpec()
adjust = &api.ContainerAdjustment{}
)
oomScoreAdj := 123
spec.Process.OOMScoreAdj = &oomScoreAdj
expectedSpec.Process.OOMScoreAdj = &oomScoreAdj

rg := &rgen.Generator{Config: spec}
xg := xgen.SpecGenerator(rg)

Expect(xg).ToNot(BeNil())
Expect(xg.Adjust(adjust)).To(Succeed())
Expect(spec).To(Equal(expectedSpec))
})
})

When("has CPU shares", func() {
It("adjusts Spec correctly", func() {
var (
Expand Down

0 comments on commit e8dd22a

Please sign in to comment.