Skip to content

Commit

Permalink
Add memory limit workaround (kubevirt#3349)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas-David Griedel <[email protected]>
  • Loading branch information
Davo911 authored Aug 8, 2024
1 parent 968c81b commit 988dc68
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/system/prlimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"testing"
Expand All @@ -39,6 +40,13 @@ var _ = Describe("Process Limits", func() {
limits := &ProcessLimitValues{1, 1}
nullLimiter := newTestProcessLimiter(nil, nil)

realLimits := &ProcessLimitValues{1 << 30, 10}

//workaround for https://github.com/kubevirt/containerized-data-importer/issues/3341
if runtime.GOARCH == "s390x" {
realLimits = &ProcessLimitValues{1 << 31, 10}
}

DescribeTable("exec", func(commandOverride func(context.Context, string, ...string) *exec.Cmd, limiter ProcessLimiter, limits *ProcessLimitValues, command, output, errString string, args ...string) {
replaceExecCommandContext(commandOverride, func() {
replaceLimiter(limiter, func() {
Expand All @@ -59,7 +67,7 @@ var _ = Describe("Process Limits", func() {
})
})
},
Entry("command success with real limits", fakeCommandContext, nil, &ProcessLimitValues{1 << 30, 10}, "faker", "", "", "0", "", ""),
Entry("command success with real limits", fakeCommandContext, nil, realLimits, "faker", "", "", "0", "", ""),
Entry("command start fails", badCommand, nullLimiter, limits, "faker", "", "fork/exec /usr/bin/doesnotexist: no such file or directory", "", "", ""),
Entry("address space limit fails", fakeCommandContext, newTestProcessLimiter(errors.New("Set address limit fails"), nil), limits, "faker", "", "Set address limit fails", "", "", ""),
Entry("command exit bad", fakeCommandContext, nullLimiter, limits, "faker", "", "exit status 1", "1", "", ""),
Expand Down

0 comments on commit 988dc68

Please sign in to comment.