Skip to content

Commit

Permalink
e2e: enable memory oversubscription (#10557)
Browse files Browse the repository at this point in the history
Enable memory oversubscription for the oversubscription tests.
  • Loading branch information
Mahmood Ali authored May 10, 2021
1 parent ee1163e commit 490f393
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion e2e/oversubscription/oversubscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

type OversubscriptionTest struct {
framework.TC
jobIDs []string
jobIDs []string
initialSchedulerConfig *api.SchedulerConfiguration
}

func init() {
Expand All @@ -29,6 +30,30 @@ func (tc *OversubscriptionTest) BeforeAll(f *framework.F) {
e2eutil.WaitForLeader(f.T(), tc.Nomad())
e2eutil.WaitForNodesReady(f.T(), tc.Nomad(), 1)

tc.enableMemoryOversubscription(f)
}

func (tc *OversubscriptionTest) AfterAll(f *framework.F) {
tc.restoreSchedulerConfig(f)
}

func (tc *OversubscriptionTest) enableMemoryOversubscription(f *framework.F) {
resp, _, err := tc.Nomad().Operator().SchedulerGetConfiguration(nil)
f.NoError(err)

tc.initialSchedulerConfig = resp.SchedulerConfig

conf := *resp.SchedulerConfig
conf.MemoryOversubscriptionEnabled = true
_, _, err = tc.Nomad().Operator().SchedulerSetConfiguration(&conf, nil)
f.NoError(err)
}

func (tc *OversubscriptionTest) restoreSchedulerConfig(f *framework.F) {
if tc.initialSchedulerConfig != nil {
_, _, err := tc.Nomad().Operator().SchedulerSetConfiguration(tc.initialSchedulerConfig, nil)
f.NoError(err)
}
}

func (tc *OversubscriptionTest) AfterEach(f *framework.F) {
Expand Down

0 comments on commit 490f393

Please sign in to comment.