diff --git a/e2e/rawexec/input/oversub.hcl b/e2e/oversubscription/input/rawexec.hcl similarity index 100% rename from e2e/rawexec/input/oversub.hcl rename to e2e/oversubscription/input/rawexec.hcl diff --git a/e2e/rawexec/input/oversubmax.hcl b/e2e/oversubscription/input/rawexecmax.hcl similarity index 100% rename from e2e/rawexec/input/oversubmax.hcl rename to e2e/oversubscription/input/rawexecmax.hcl diff --git a/e2e/oversubscription/oversubscription_test.go b/e2e/oversubscription/oversubscription_test.go index 1ca612009..e0a5db54d 100644 --- a/e2e/oversubscription/oversubscription_test.go +++ b/e2e/oversubscription/oversubscription_test.go @@ -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) } diff --git a/e2e/rawexec/rawexec_test.go b/e2e/rawexec/rawexec_test.go index 6c52a93d8..8907e797e 100644 --- a/e2e/rawexec/rawexec_test.go +++ b/e2e/rawexec/rawexec_test.go @@ -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) -}