mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Add test: starting the same job twice is bad
This commit is contained in:
parent
92349708ae
commit
31f31fcece
@ -11,6 +11,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ClusterCockpit/cc-backend/api"
|
"github.com/ClusterCockpit/cc-backend/api"
|
||||||
@ -295,4 +296,18 @@ func TestRestApi(t *testing.T) {
|
|||||||
t.Fatal("unexpected data fetched from archive")
|
t.Fatal("unexpected data fetched from archive")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("CheckDoubleStart", func(t *testing.T) {
|
||||||
|
// Starting a job with the same jobId and cluster should only be allowed if the startTime is far appart!
|
||||||
|
body := strings.Replace(startJobBody, `"startTime": 123456789`, `"startTime": 123456790`, -1)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/api/jobs/start_job/", bytes.NewBuffer([]byte(body)))
|
||||||
|
recorder := httptest.NewRecorder()
|
||||||
|
|
||||||
|
r.ServeHTTP(recorder, req)
|
||||||
|
response := recorder.Result()
|
||||||
|
if response.StatusCode != http.StatusUnprocessableEntity {
|
||||||
|
t.Fatal(response.Status, recorder.Body.String())
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user