8784: Fix test for latest firefox.
[arvados.git] / sdk / go / dispatch / dispatch_test.go
1 package dispatch
2
3 import (
4         "time"
5
6         "git.curoverse.com/arvados.git/sdk/go/arvados"
7         "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
8         "git.curoverse.com/arvados.git/sdk/go/arvadostest"
9         . "gopkg.in/check.v1"
10 )
11
12 // Gocheck boilerplate
13 var _ = Suite(&suite{})
14
15 type suite struct{}
16
17 func (s *suite) SetUpSuite(c *C) {
18         arvadostest.StartAPI()
19 }
20
21 func (s *suite) TearDownSuite(c *C) {
22         arvadostest.StopAPI()
23 }
24
25 func (s *suite) TestTrackContainer(c *C) {
26         arv, err := arvadosclient.MakeArvadosClient()
27         c.Assert(err, Equals, nil)
28         arv.ApiToken = arvadostest.Dispatch1Token
29
30         done := make(chan bool, 1)
31         time.AfterFunc(10*time.Second, func() { done <- false })
32         d := &Dispatcher{
33                 Arv: arv,
34                 RunContainer: func(dsp *Dispatcher, ctr arvados.Container, status <-chan arvados.Container) {
35                         for ctr := range status {
36                                 c.Logf("%#v", ctr)
37                         }
38                         done <- true
39                 },
40         }
41         d.TrackContainer(arvadostest.QueuedContainerUUID)
42         c.Assert(<-done, Equals, true)
43 }