mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
e2e: move rawexec oversub tests into oversubscription e2e test suite (#19717)
* e2e: move rawexec oversub tests into oversubscription e2e test suite This PR moves two tests for raw_exec and memory oversubscription into the oversubscription test suite, which has the necessary plumbing to activate and restore the oversubscription configuration of the scheduler during the test. * cr: rename files for better readability
This commit is contained in:
@@ -5,6 +5,7 @@ package oversubscription
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -38,6 +39,8 @@ func TestOversubscription(t *testing.T) {
|
||||
|
||||
t.Run("testDocker", testDocker)
|
||||
t.Run("testExec", testExec)
|
||||
t.Run("testRawExec", testRawExec)
|
||||
t.Run("testRawExecMax", testRawExecMax)
|
||||
}
|
||||
|
||||
func testDocker(t *testing.T) {
|
||||
@@ -73,6 +76,24 @@ func testExec(t *testing.T) {
|
||||
))
|
||||
}
|
||||
|
||||
func testRawExec(t *testing.T) {
|
||||
job, cleanup := jobs3.Submit(t, "./input/rawexec.hcl")
|
||||
t.Cleanup(cleanup)
|
||||
|
||||
logs := job.TaskLogs("group", "cat")
|
||||
must.StrContains(t, logs.Stdout, "134217728") // 128 mb memory_max
|
||||
}
|
||||
|
||||
func testRawExecMax(t *testing.T) {
|
||||
job, cleanup := jobs3.Submit(t, "./input/rawexecmax.hcl")
|
||||
t.Cleanup(cleanup)
|
||||
|
||||
// will print memory.low then memory.max
|
||||
logs := job.TaskLogs("group", "cat")
|
||||
logsRe := regexp.MustCompile(`67108864\s+max`)
|
||||
must.RegexMatch(t, logsRe, logs.Stdout)
|
||||
}
|
||||
|
||||
func captureSchedulerConfiguration(t *testing.T) {
|
||||
origConfig = getSchedulerConfiguration(t)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package rawexec
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/nomad/e2e/v3/cluster3"
|
||||
@@ -19,8 +18,6 @@ func TestRawExec(t *testing.T) {
|
||||
)
|
||||
|
||||
t.Run("testOomAdj", testOomAdj)
|
||||
t.Run("testOversubMemory", testOversubMemory)
|
||||
t.Run("testOversubMemoryUnlimited", testOversubMemoryUnlimited)
|
||||
}
|
||||
|
||||
func testOomAdj(t *testing.T) {
|
||||
@@ -30,21 +27,3 @@ func testOomAdj(t *testing.T) {
|
||||
logs := job.TaskLogs("group", "cat")
|
||||
must.StrContains(t, logs.Stdout, "0")
|
||||
}
|
||||
|
||||
func testOversubMemory(t *testing.T) {
|
||||
job, cleanup := jobs3.Submit(t, "./input/oversub.hcl")
|
||||
t.Cleanup(cleanup)
|
||||
|
||||
logs := job.TaskLogs("group", "cat")
|
||||
must.StrContains(t, logs.Stdout, "134217728") // 128 mb memory_max
|
||||
}
|
||||
|
||||
func testOversubMemoryUnlimited(t *testing.T) {
|
||||
job, cleanup := jobs3.Submit(t, "./input/oversubmax.hcl")
|
||||
t.Cleanup(cleanup)
|
||||
|
||||
// will print memory.low then memory.max
|
||||
logs := job.TaskLogs("group", "cat")
|
||||
logsRe := regexp.MustCompile(`67108864\s+max`)
|
||||
must.RegexMatch(t, logsRe, logs.Stdout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user