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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/api/unitassigner/unitassigner_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:
115
115
func (f *fakeWatchCaller) APICall(objType string, version int, id, request string, param, response interface{}) error {
116
116
        f.Lock()
117
117
        defer f.Unlock()
118
 
        f.request = request
119
 
        f.params = param
120
 
        _, ok := response.(*params.StringsWatchResult)
121
 
        if !ok {
122
 
                f.c.Errorf("Expected *params.StringsWatchResult as response, but was %#v", response)
 
118
 
 
119
        // We only care for the first request as that is all the tests
 
120
        // assert on. The watcher (StringsWatcher) is continuously
 
121
        // running and this function gets called repeatedly
 
122
        // overwriting f.request leading to intermittent failures.
 
123
        // Fixes: https://bugs.launchpad.net/juju/+bug/1606302
 
124
 
 
125
        if f.request == "" {
 
126
                f.request = request
 
127
                f.params = param
 
128
                _, ok := response.(*params.StringsWatchResult)
 
129
                if !ok {
 
130
                        f.c.Errorf("Expected *params.StringsWatchResult as response, but was %#v", response)
 
131
                }
123
132
        }
124
133
        return f.err
125
134
}