mirror of
https://github.com/simon987/task_tracker.git
synced 2025-04-18 01:46:45 +00:00
Fix a task chain bug
This commit is contained in:
parent
ab040ae040
commit
ce5344d9c7
4
jenkins/Jenkinsfile
vendored
4
jenkins/Jenkinsfile
vendored
@ -4,6 +4,10 @@ remote.host = 'localhost'
|
||||
remote.user = 'simon'
|
||||
remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa'
|
||||
remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts'
|
||||
remote.allowAnyHosts = true
|
||||
remote.retryCount = 3
|
||||
remote.retryWaitSec = 3
|
||||
logLevel = 'FINER'
|
||||
|
||||
pipeline {
|
||||
agent none
|
||||
|
@ -113,7 +113,8 @@ BEGIN
|
||||
priority, retries, max_retries, status, recipe)
|
||||
VALUES (old.hash64, chain, NULL, old.max_assign_time, NULL,
|
||||
old.verification_count, old.priority, 0, old.max_retries, 1,
|
||||
old.recipe);
|
||||
old.recipe)
|
||||
ON CONFLICT DO NOTHING;
|
||||
end if;
|
||||
end if;
|
||||
RETURN OLD;
|
||||
|
@ -881,6 +881,55 @@ func TestTaskGetUnauthorized(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTaskChainCausesConflict(t *testing.T) {
|
||||
p1 := createProjectAsAdmin(api.CreateProjectRequest{
|
||||
Name: "testtaskchainconflict",
|
||||
CloneUrl: "testtaskchainconfflict",
|
||||
Public: false,
|
||||
}).Content.Id
|
||||
|
||||
p2 := createProjectAsAdmin(api.CreateProjectRequest{
|
||||
Name: "testtaskchainconflict2",
|
||||
CloneUrl: "testtaskchainconfflict2",
|
||||
Public: false,
|
||||
Chain: p1,
|
||||
}).Content.Id
|
||||
|
||||
w := genWid()
|
||||
requestAccess(api.CreateWorkerAccessRequest{
|
||||
Project: p1,
|
||||
Assign: true,
|
||||
Submit: true,
|
||||
}, w)
|
||||
requestAccess(api.CreateWorkerAccessRequest{
|
||||
Project: p2,
|
||||
Assign: true,
|
||||
Submit: true,
|
||||
}, w)
|
||||
acceptAccessRequest(p1, w.Id, testAdminCtx)
|
||||
acceptAccessRequest(p2, w.Id, testAdminCtx)
|
||||
|
||||
createTask(api.SubmitTaskRequest{
|
||||
Project: p2,
|
||||
Recipe: " ",
|
||||
Hash64: 1,
|
||||
}, w)
|
||||
createTask(api.SubmitTaskRequest{
|
||||
Project: p1,
|
||||
Recipe: " ",
|
||||
Hash64: 1,
|
||||
}, w)
|
||||
tid := getTaskFromProject(p2, w).Content.Task.Id
|
||||
resp := releaseTask(api.ReleaseTaskRequest{
|
||||
TaskId: tid,
|
||||
Result: storage.TR_OK,
|
||||
}, w)
|
||||
|
||||
if resp.Ok != true {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func createTask(request api.SubmitTaskRequest, worker *storage.Worker) (ar api.JsonResponse) {
|
||||
r := Post("/task/submit", request, worker, nil)
|
||||
UnmarshalResponse(r, &ar)
|
||||
|
@ -113,7 +113,8 @@ BEGIN
|
||||
priority, retries, max_retries, status, recipe)
|
||||
VALUES (old.hash64, chain, NULL, old.max_assign_time, NULL,
|
||||
old.verification_count, old.priority, 0, old.max_retries, 1,
|
||||
old.recipe);
|
||||
old.recipe)
|
||||
ON CONFLICT DO NOTHING;
|
||||
end if;
|
||||
end if;
|
||||
RETURN OLD;
|
||||
|
Loading…
x
Reference in New Issue
Block a user