Add project secret & bug fix

This commit is contained in:
simon987
2019-02-19 19:38:54 -05:00
parent 94c3ce3267
commit f235bfb588
27 changed files with 443 additions and 54 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/simon987/task_tracker/api"
"github.com/simon987/task_tracker/storage"
"math"
"testing"
)
@@ -780,6 +781,42 @@ func TestTaskChain(t *testing.T) {
}
}
func TestTaskReleaseBigInt(t *testing.T) {
createTask(api.SubmitTaskRequest{
Project: testProject,
VerificationCount: 1,
Recipe: "bigint",
}, testWorker)
createTask(api.SubmitTaskRequest{
Project: testProject,
VerificationCount: 1,
Recipe: "smallint",
}, testWorker)
tid := getTaskFromProject(testProject, testWorker).Content.Task.Id
tid2 := getTaskFromProject(testProject, testWorker).Content.Task.Id
r := releaseTask(api.ReleaseTaskRequest{
Verification: math.MaxInt64,
Result: storage.TR_OK,
TaskId: tid,
}, testWorker)
r2 := releaseTask(api.ReleaseTaskRequest{
Verification: math.MinInt64,
Result: storage.TR_OK,
TaskId: tid2,
}, testWorker)
if r.Content.Updated != true {
t.Error()
}
if r2.Content.Updated != true {
t.Error()
}
}
func createTask(request api.SubmitTaskRequest, worker *storage.Worker) (ar api.JsonResponse) {
r := Post("/task/submit", request, worker, nil)
UnmarshalResponse(r, &ar)