new test: start/stop job via REST API

This commit is contained in:
Lou Knauer
2022-01-24 10:08:47 +01:00
parent ae3e03f9b9
commit 7359a556d9
4 changed files with 297 additions and 10 deletions

View File

@@ -183,8 +183,8 @@ func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
return
}
if config.GetClusterConfig(req.Cluster) == nil {
http.Error(rw, fmt.Sprintf("cluster '%s' does not exist", req.Cluster), http.StatusBadRequest)
if config.GetClusterConfig(req.Cluster) == nil || config.GetPartition(req.Cluster, req.Partition) == nil {
http.Error(rw, fmt.Sprintf("cluster %#v or partition %#v does not exist", req.Cluster, req.Partition), http.StatusBadRequest)
return
}
@@ -209,6 +209,10 @@ func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
return
}
if req.State == "" {
req.State = schema.JobStateRunning
}
req.RawResources, err = json.Marshal(req.Resources)
if err != nil {
log.Fatal(err)