~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/txnpruner/txnpruner_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        case <-time.After(coretesting.LongWait):
34
34
                c.Fatalf("timed out waiting for worker to stat")
35
35
        }
36
 
 
 
36
        c.Logf("pruner running and waiting: %s (%s)", testClock.Now(), time.Now())
37
37
        // Show that we prune every minute
38
38
        for i := 0; i < 5; i++ {
39
39
                testClock.Advance(interval)
 
40
                c.Logf("loop %d: %s (%s)", i, testClock.Now(), time.Now())
40
41
                select {
41
42
                case <-fakePruner.pruneCh:
42
43
                case <-time.After(coretesting.LongWait):
43
44
                        c.Fatal("timed out waiting for pruning to happen")
44
45
                }
 
46
                // Now we need to wait for the txn pruner to call clock.After again
 
47
                // before we advance the clock, or it will be waiting for the wrong time.
 
48
                select {
 
49
                case <-testClock.Alarms():
 
50
                case <-time.After(coretesting.LongWait):
 
51
                        c.Fatalf("timed out waiting for worker to loop around")
 
52
                }
45
53
        }
46
54
}
47
55