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:
Seth Hoenig
2024-01-11 14:27:05 -06:00
committed by GitHub
parent 8d0a469000
commit a58f0eca8e
4 changed files with 21 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ package oversubscription
import ( import (
"fmt" "fmt"
"regexp"
"strings" "strings"
"testing" "testing"
"time" "time"
@@ -38,6 +39,8 @@ func TestOversubscription(t *testing.T) {
t.Run("testDocker", testDocker) t.Run("testDocker", testDocker)
t.Run("testExec", testExec) t.Run("testExec", testExec)
t.Run("testRawExec", testRawExec)
t.Run("testRawExecMax", testRawExecMax)
} }
func testDocker(t *testing.T) { 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) { func captureSchedulerConfiguration(t *testing.T) {
origConfig = getSchedulerConfiguration(t) origConfig = getSchedulerConfiguration(t)
} }

View File

@@ -4,7 +4,6 @@
package rawexec package rawexec
import ( import (
"regexp"
"testing" "testing"
"github.com/hashicorp/nomad/e2e/v3/cluster3" "github.com/hashicorp/nomad/e2e/v3/cluster3"
@@ -19,8 +18,6 @@ func TestRawExec(t *testing.T) {
) )
t.Run("testOomAdj", testOomAdj) t.Run("testOomAdj", testOomAdj)
t.Run("testOversubMemory", testOversubMemory)
t.Run("testOversubMemoryUnlimited", testOversubMemoryUnlimited)
} }
func testOomAdj(t *testing.T) { func testOomAdj(t *testing.T) {
@@ -30,21 +27,3 @@ func testOomAdj(t *testing.T) {
logs := job.TaskLogs("group", "cat") logs := job.TaskLogs("group", "cat")
must.StrContains(t, logs.Stdout, "0") 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)
}