Fix pure-go unittests

So they can run on e.g. LXC containers as root, or other conceivable setups.
This commit is contained in:
Lorenzo Bolla
2021-11-02 17:30:48 +01:00
parent 370e3cdfea
commit 6826efc723
4 changed files with 41 additions and 4 deletions
+3
View File
@@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"
"time"
"github.com/aptly-dev/aptly/task"
@@ -44,6 +45,8 @@ func (s *TaskSuite) TestTaskDelete(c *C) {
response, _ := s.HTTPRequest("POST", "/api/tasks-dummy?_async=true", nil)
c.Check(response.Code, Equals, 202)
c.Check(response.Body.String(), Equals, "{\"Name\":\"Dummy task\",\"ID\":1,\"State\":0}")
// Give the task time to start
time.Sleep(time.Second)
response, _ = s.HTTPRequest("DELETE", "/api/tasks/1", nil)
c.Check(response.Code, Equals, 200)
}