Return SchedulerConfig instead of SchedulerConfigResponse struct (#10799)

This commit is contained in:
Charlie Voiselle
2021-10-13 21:23:13 -04:00
committed by GitHub
parent 6a0dede9b6
commit 8ba714e211
7 changed files with 63 additions and 58 deletions

View File

@@ -246,7 +246,7 @@ func (s *HTTPServer) schedulerGetConfig(resp http.ResponseWriter, req *http.Requ
}
setMeta(resp, &reply.QueryMeta)
return reply, nil
return reply.SchedulerConfig, nil
}
func (s *HTTPServer) schedulerUpdateConfig(resp http.ResponseWriter, req *http.Request) (interface{}, error) {

View File

@@ -277,15 +277,15 @@ func TestOperator_SchedulerGetConfiguration(t *testing.T) {
obj, err := s.Server.OperatorSchedulerConfiguration(resp, req)
require.Nil(err)
require.Equal(200, resp.Code)
out, ok := obj.(structs.SchedulerConfigurationResponse)
out, ok := obj.(*structs.SchedulerConfiguration)
require.True(ok)
// Only system jobs can preempt other jobs by default.
require.True(out.SchedulerConfig.PreemptionConfig.SystemSchedulerEnabled)
require.False(out.SchedulerConfig.PreemptionConfig.SysBatchSchedulerEnabled)
require.False(out.SchedulerConfig.PreemptionConfig.BatchSchedulerEnabled)
require.False(out.SchedulerConfig.PreemptionConfig.ServiceSchedulerEnabled)
require.False(out.SchedulerConfig.MemoryOversubscriptionEnabled)
require.True(out.PreemptionConfig.SystemSchedulerEnabled)
require.False(out.PreemptionConfig.SysBatchSchedulerEnabled)
require.False(out.PreemptionConfig.BatchSchedulerEnabled)
require.False(out.PreemptionConfig.ServiceSchedulerEnabled)
require.False(out.MemoryOversubscriptionEnabled)
})
}