Merge lp:~wallyworld/juju-core/instance-poller-noise into lp:~go-bot/juju-core/trunk
- instance-poller-noise
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Ian Booth | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 2589 | ||||||||
Proposed branch: | lp:~wallyworld/juju-core/instance-poller-noise | ||||||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||||||
Diff against target: |
245 lines (+101/-14) 3 files modified
worker/instancepoller/machine_test.go (+29/-9) worker/instancepoller/updater.go (+20/-5) worker/instancepoller/updater_test.go (+52/-0) |
||||||||
To merge this branch: | bzr merge lp:~wallyworld/juju-core/instance-poller-noise | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+214857@code.launchpad.net |
Commit message
Noisy instance poller
The instance poller was trying to poll instances which
are not yet provisioned, as well as manual instances, creating lots of log noise.
This fixes that.
Description of the change
Noisy instance poller
The instance poller was trying to poll instances which
are not yet provisioned, as well as manual instances, creating lots of log noise.
This fixes that.
Ian Booth (wallyworld) wrote : | # |
Dave Cheney (dave-cheney) wrote : | # |
LGTM. Thanks
On Wed, Apr 9, 2014 at 10:24 AM, Ian Booth <email address hidden> wrote:
> Reviewers: mp+214857_
>
> Message:
> Please take a look.
>
> Description:
> Noisy instance poller
>
> The instance poller was trying to poll instances which
> are not yet provisioned, creating lots of log noise.
> This fixes that.
>
> https:/
>
> (do not edit description out of merge proposal)
>
>
> Please review this at https:/
>
> Affected files (+25, -9 lines):
> A [revision details]
> M worker/
> M worker/
>
>
> Index: [revision details]
> === added file '[revision details]'
> --- [revision details] 2012-01-01 00:00:00 +0000
> +++ [revision details] 2012-01-01 00:00:00 +0000
> @@ -0,0 +1,2 @@
> +Old revision: tarmac-
> +New revision: <email address hidden>
>
> Index: worker/
> === modified file 'worker/
> --- worker/
> +++ worker/
> @@ -61,24 +61,31 @@
> func (s *machineSuite) TestShortPollIn
> s.PatchValue(
> s.PatchValue(
> - count := countPolls(c, nil, "running", params.
> + count := countPolls(c, nil, "i1234", "running", params.
> c.Assert(count, jc.GreaterThan, 2)
> }
>
> func (s *machineSuite) TestShortPollIn
> s.PatchValue(
> s.PatchValue(
> - count := countPolls(c, testAddrs, "", params.
> + count := countPolls(c, testAddrs, "i1234", "", params.
> c.Assert(count, jc.GreaterThan, 2)
> }
>
> func (s *machineSuite) TestShortPollIn
> s.PatchValue(
> s.PatchValue(
> - count := countPolls(c, testAddrs, "pending", params.
> + count := countPolls(c, testAddrs, "i1234", "pending",
> params.
> c.Assert(count, jc.GreaterThan, 2)
> }
>
> +func (s *machineSuite) TestShortPollIn
> + s.PatchValue(
> + s.PatchValue(
> + count := countPolls(c, testAddrs, "", "pending", params.
> + c.Assert(count, gc.Equals, 0)
> +}
> +
> func (s *machineSuite) TestShortPollIn
> s.PatchValue(
> s.PatchValue(
> @@ -89,7 +96,7 @@
> // ShortPollBackoff of ShortWait/
> // sleep for at least the requested interval.
> maxCount :=
> int(math.
Andrew Wilkins (axwalk) wrote : | # |
Yay, LGTM. Just one thought below...
https:/
File worker/
https:/
worker/
m.Status()
This Status() call should be avoided if the instance isn't provisioned,
I think?
Ian Booth (wallyworld) wrote : | # |
Please take a look.
Ian Booth (wallyworld) wrote : | # |
On 2014/04/09 01:12:04, axw wrote:
> Yay, LGTM. Just one thought below...
https:/
> File worker/
https:/
> worker/
m.Status()
> This Status() call should be avoided if the instance isn't
provisioned, I think?
Yeah, I thought about it but then didn't want to duplicate the poll
interval backoff line. But I'll tweak it as it's best not not make an
unnecessary call.
Ian Booth (wallyworld) wrote : | # |
Please take a look.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~wallyworld/juju-core/instance-poller-noise into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
panic: test timed out
goroutine 4583 [running]:
testing.alarm()
/usr/lib/
created by time.goFunc
/usr/lib/
goroutine 1 [chan receive]:
testing.
/usr/lib/
testing.
/usr/lib/
main.main()
launchpad.
goroutine 2 [syscall]:
goroutine 4 [syscall]:
os/signal.loop()
/usr/lib/
created by os/signal.init·1
/usr/lib/
goroutine 6 [chan receive]:
launchpad.
/home/
created by launchpad.
/home/
goroutine 9 [chan receive]:
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
testing.
/usr/lib/
created by testing.RunTests
/u...
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~wallyworld/juju-core/instance-poller-noise into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
-------
PANIC: agent.go:0: MachineSuite.
[LOG] 93.14301 DEBUG juju.environs.
[LOG] 93.21764 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 93.21830 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 93.22409 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 93.22514 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 93.22515 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 93.22522 DEBUG juju.environs.
[LOG] 93.22527 DEBUG juju.environs.
[LOG] 93.22529 DEBUG juju.environs.
[LOG] 93.22531 DEBUG juju.environs.
[LOG] 93.22572 INFO juju.environs.tools Writing tools/streams/
[LOG] 93.22576 INFO juju.environs.tools Writing tools/streams/
[LOG] 93.22585 DEBUG juju.environs.
[LOG] 93.22586 INFO juju.environs.
[LOG] 93.22590 DEBUG juju.environs.
[LOG] 93.22592 INFO juju.environs.tools reading tools with major.minor version 1.19
[LOG] 93.22593 INFO juju.environs.tools filtering tools by version: 1.19.0
[LOG] 93.22594 INFO juju.environs.tools filtering tools by series: precise
[LOG] 93.22595 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 93.22598 DEBUG juju.environs.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~wallyworld/juju-core/instance-poller-noise into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
panic: Session already closed
goroutine 2007 [running]:
labix.org/
/home/
labix.org/
/home/
labix.org/
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
created by launchpad.
/home/
goroutine 1 [chan receive]:
testing.
/usr/lib/
testing.
/usr/lib/
main.main()
launchpad.
goroutine 2 [syscall]:
goroutine 4 [syscall]:
os/signal.loop()
/usr/lib/
created by os/signal.init·1
/usr/lib/
goroutine 6 [chan receive]:
launchpad.
/home/
created by launchpad.
/home/
goroutine 9 [chan receive]:
launchpad.
/home/
launchpad.
/home/
launchpad.net/g...
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~wallyworld/juju-core/instance-poller-noise into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
-------
PANIC: agent.go:0: MachineSuite.
[LOG] 15.07518 DEBUG juju.environs.
[LOG] 15.15141 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 15.16909 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 15.16960 INFO juju environs/testing: uploading FAKE tools 1.19.0-
[LOG] 15.17008 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 15.17009 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 15.17013 DEBUG juju.environs.
[LOG] 15.17015 DEBUG juju.environs.
[LOG] 15.17017 DEBUG juju.environs.
[LOG] 15.17019 DEBUG juju.environs.
[LOG] 15.17040 INFO juju.environs.tools Writing tools/streams/
[LOG] 15.17042 INFO juju.environs.tools Writing tools/streams/
[LOG] 15.17046 DEBUG juju.environs.
[LOG] 15.17046 INFO juju.environs.
[LOG] 15.17049 DEBUG juju.environs.
[LOG] 15.17050 INFO juju.environs.tools reading tools with major.minor version 1.19
[LOG] 15.17051 INFO juju.environs.tools filtering tools by version: 1.19.0
[LOG] 15.17052 INFO juju.environs.tools filtering tools by series: precise
[LOG] 15.17053 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 15.17055 DEBUG juju.environs.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~wallyworld/juju-core/instance-poller-noise into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
panic: Session already closed
goroutine 2006 [running]:
labix.org/
/home/
labix.org/
/home/
labix.org/
/home/
launchpad.
/home/
launchpad.
/home/
launchpad.
/home/
created by launchpad.
/home/
goroutine 1 [chan receive]:
testing.
/usr/lib/
testing.
/usr/lib/
main.main()
launchpad.
goroutine 2 [syscall]:
goroutine 4 [syscall]:
os/signal.loop()
/usr/lib/
created by os/signal.init·1
/usr/lib/
goroutine 6 [chan receive]:
launchpad.
/home/
created by launchpad.
/home/
goroutine 9 [chan receive]:
launchpad.
/home/
launchpad.
/home/
launchpad.net/g...
Preview Diff
1 | === modified file 'worker/instancepoller/machine_test.go' |
2 | --- worker/instancepoller/machine_test.go 2014-04-01 23:56:19 +0000 |
3 | +++ worker/instancepoller/machine_test.go 2014-04-09 03:09:15 +0000 |
4 | @@ -8,6 +8,7 @@ |
5 | stderrors "errors" |
6 | "fmt" |
7 | "math" |
8 | + "strings" |
9 | "sync" |
10 | "sync/atomic" |
11 | "time" |
12 | @@ -61,24 +62,31 @@ |
13 | func (s *machineSuite) TestShortPollIntervalWhenNoAddress(c *gc.C) { |
14 | s.PatchValue(&ShortPoll, 1*time.Millisecond) |
15 | s.PatchValue(&LongPoll, coretesting.LongWait) |
16 | - count := countPolls(c, nil, "running", params.StatusStarted) |
17 | + count := countPolls(c, nil, "i1234", "running", params.StatusStarted) |
18 | c.Assert(count, jc.GreaterThan, 2) |
19 | } |
20 | |
21 | func (s *machineSuite) TestShortPollIntervalWhenNoStatus(c *gc.C) { |
22 | s.PatchValue(&ShortPoll, 1*time.Millisecond) |
23 | s.PatchValue(&LongPoll, coretesting.LongWait) |
24 | - count := countPolls(c, testAddrs, "", params.StatusStarted) |
25 | + count := countPolls(c, testAddrs, "i1234", "", params.StatusStarted) |
26 | c.Assert(count, jc.GreaterThan, 2) |
27 | } |
28 | |
29 | func (s *machineSuite) TestShortPollIntervalWhenNotStarted(c *gc.C) { |
30 | s.PatchValue(&ShortPoll, 1*time.Millisecond) |
31 | s.PatchValue(&LongPoll, coretesting.LongWait) |
32 | - count := countPolls(c, testAddrs, "pending", params.StatusPending) |
33 | + count := countPolls(c, testAddrs, "i1234", "pending", params.StatusPending) |
34 | c.Assert(count, jc.GreaterThan, 2) |
35 | } |
36 | |
37 | +func (s *machineSuite) TestShortPollIntervalWhenNotProvisioned(c *gc.C) { |
38 | + s.PatchValue(&ShortPoll, 1*time.Millisecond) |
39 | + s.PatchValue(&LongPoll, coretesting.LongWait) |
40 | + count := countPolls(c, testAddrs, "", "pending", params.StatusPending) |
41 | + c.Assert(count, gc.Equals, 0) |
42 | +} |
43 | + |
44 | func (s *machineSuite) TestShortPollIntervalExponent(c *gc.C) { |
45 | s.PatchValue(&ShortPoll, 1*time.Microsecond) |
46 | s.PatchValue(&LongPoll, coretesting.LongWait) |
47 | @@ -89,7 +97,7 @@ |
48 | // ShortPollBackoff of ShortWait/ShortPoll, given that sleep will |
49 | // sleep for at least the requested interval. |
50 | maxCount := int(math.Log(float64(coretesting.ShortWait)/float64(ShortPoll))/math.Log(ShortPollBackoff) + 1) |
51 | - count := countPolls(c, nil, "", params.StatusStarted) |
52 | + count := countPolls(c, nil, "i1234", "", params.StatusStarted) |
53 | c.Assert(count, jc.GreaterThan, 2) |
54 | c.Assert(count, jc.LessThan, maxCount) |
55 | c.Logf("actual count: %v; max %v", count, maxCount) |
56 | @@ -98,7 +106,7 @@ |
57 | func (s *machineSuite) TestLongPollIntervalWhenHasAllInstanceInfo(c *gc.C) { |
58 | s.PatchValue(&ShortPoll, coretesting.LongWait) |
59 | s.PatchValue(&LongPoll, 1*time.Millisecond) |
60 | - count := countPolls(c, testAddrs, "running", params.StatusStarted) |
61 | + count := countPolls(c, testAddrs, "i1234", "running", params.StatusStarted) |
62 | c.Assert(count, jc.GreaterThan, 2) |
63 | } |
64 | |
65 | @@ -106,10 +114,10 @@ |
66 | // addresses and status to be returned from getInstanceInfo, |
67 | // waits for coretesting.ShortWait, and returns the |
68 | // number of times the instance is polled. |
69 | -func countPolls(c *gc.C, addrs []instance.Address, instStatus string, machineStatus params.Status) int { |
70 | +func countPolls(c *gc.C, addrs []instance.Address, instId, instStatus string, machineStatus params.Status) int { |
71 | count := int32(0) |
72 | getInstanceInfo := func(id instance.Id) (instanceInfo, error) { |
73 | - c.Check(id, gc.Equals, instance.Id("i1234")) |
74 | + c.Check(string(id), gc.Equals, instId) |
75 | atomic.AddInt32(&count, 1) |
76 | if addrs == nil { |
77 | return instanceInfo{}, fmt.Errorf("no instance addresses available") |
78 | @@ -122,7 +130,7 @@ |
79 | } |
80 | m := &testMachine{ |
81 | id: "99", |
82 | - instanceId: "i1234", |
83 | + instanceId: instance.Id(instId), |
84 | refresh: func() error { return nil }, |
85 | addresses: addrs, |
86 | life: state.Alive, |
87 | @@ -342,11 +350,23 @@ |
88 | } |
89 | |
90 | func (m *testMachine) InstanceId() (instance.Id, error) { |
91 | + if m.instanceId == "" { |
92 | + return "", state.NotProvisionedError(m.Id()) |
93 | + } |
94 | return m.instanceId, m.instanceIdErr |
95 | } |
96 | |
97 | +// This is stubbed out for testing. |
98 | +var MachineStatus = func(m *testMachine) (status params.Status, info string, data params.StatusData, err error) { |
99 | + return m.status, "", nil, nil |
100 | +} |
101 | + |
102 | func (m *testMachine) Status() (status params.Status, info string, data params.StatusData, err error) { |
103 | - return m.status, "", nil, nil |
104 | + return MachineStatus(m) |
105 | +} |
106 | + |
107 | +func (m *testMachine) IsManual() (bool, error) { |
108 | + return strings.HasPrefix(string(m.instanceId), "manual:"), nil |
109 | } |
110 | |
111 | func (m *testMachine) InstanceStatus() (string, error) { |
112 | |
113 | === modified file 'worker/instancepoller/updater.go' |
114 | --- worker/instancepoller/updater.go 2014-03-30 22:34:01 +0000 |
115 | +++ worker/instancepoller/updater.go 2014-04-09 03:09:15 +0000 |
116 | @@ -42,6 +42,7 @@ |
117 | Refresh() error |
118 | Life() state.Life |
119 | Status() (status params.Status, info string, data params.StatusData, err error) |
120 | + IsManual() (bool, error) |
121 | } |
122 | |
123 | type instanceInfo struct { |
124 | @@ -132,6 +133,14 @@ |
125 | if err != nil { |
126 | return err |
127 | } |
128 | + // We don't poll manual machines. |
129 | + isManual, err := m.IsManual() |
130 | + if err != nil { |
131 | + return err |
132 | + } |
133 | + if isManual { |
134 | + continue |
135 | + } |
136 | c = make(chan struct{}) |
137 | p.machines[id] = c |
138 | go runMachine(p.context.newMachineContext(), m, c, p.machineDead) |
139 | @@ -171,7 +180,7 @@ |
140 | for { |
141 | if pollInstance { |
142 | instInfo, err := pollInstanceInfo(context, m) |
143 | - if err != nil { |
144 | + if err != nil && !state.IsNotProvisionedError(err) { |
145 | // If the provider doesn't implement Addresses/Status now, |
146 | // it never will until we're upgraded, so don't bother |
147 | // asking any more. We could use less resources |
148 | @@ -185,9 +194,11 @@ |
149 | return err |
150 | } |
151 | } |
152 | - machineStatus, _, _, err := m.Status() |
153 | - if err != nil { |
154 | - logger.Warningf("cannot get current machine status for machine %v: %v", m.Id(), err) |
155 | + machineStatus := params.StatusPending |
156 | + if err == nil { |
157 | + if machineStatus, _, _, err = m.Status(); err != nil { |
158 | + logger.Warningf("cannot get current machine status for machine %v: %v", m.Id(), err) |
159 | + } |
160 | } |
161 | if len(instInfo.addresses) > 0 && instInfo.status != "" && machineStatus == params.StatusStarted { |
162 | // We've got at least one address and a status and instance is started, so poll infrequently. |
163 | @@ -220,7 +231,11 @@ |
164 | func pollInstanceInfo(context machineContext, m machine) (instInfo instanceInfo, err error) { |
165 | instInfo = instanceInfo{} |
166 | instId, err := m.InstanceId() |
167 | - if err != nil && !state.IsNotProvisionedError(err) { |
168 | + // We can't ask the machine for its addresses if it isn't provisioned yet. |
169 | + if state.IsNotProvisionedError(err) { |
170 | + return instInfo, err |
171 | + } |
172 | + if err != nil { |
173 | return instInfo, fmt.Errorf("cannot get machine's instance id: %v", err) |
174 | } |
175 | instInfo, err = context.instanceInfo(instId) |
176 | |
177 | === modified file 'worker/instancepoller/updater_test.go' |
178 | --- worker/instancepoller/updater_test.go 2014-03-13 07:54:56 +0000 |
179 | +++ worker/instancepoller/updater_test.go 2014-04-09 03:09:15 +0000 |
180 | @@ -13,6 +13,7 @@ |
181 | gc "launchpad.net/gocheck" |
182 | |
183 | "launchpad.net/juju-core/state" |
184 | + "launchpad.net/juju-core/state/api/params" |
185 | coretesting "launchpad.net/juju-core/testing" |
186 | "launchpad.net/juju-core/testing/testbase" |
187 | ) |
188 | @@ -119,6 +120,57 @@ |
189 | c.Assert(watcher.stopped, jc.IsTrue) |
190 | } |
191 | |
192 | +func (s *updaterSuite) TestManualMachinesIgnored(c *gc.C) { |
193 | + waitStatus := make(chan struct{}) |
194 | + s.PatchValue(&MachineStatus, func(m *testMachine) (status params.Status, info string, data params.StatusData, err error) { |
195 | + // Signal that we're in Status. |
196 | + waitStatus <- struct{}{} |
197 | + return params.StatusPending, "", params.StatusData{}, nil |
198 | + }) |
199 | + m := &testMachine{ |
200 | + id: "99", |
201 | + instanceId: "manual:1234", |
202 | + life: state.Alive, |
203 | + } |
204 | + dyingc := make(chan struct{}) |
205 | + context := &testUpdaterContext{ |
206 | + dyingc: dyingc, |
207 | + newMachineContextFunc: func() machineContext { |
208 | + return &testMachineContext{ |
209 | + getInstanceInfo: instanceInfoGetter(c, "manual:1234", testAddrs, "running", nil), |
210 | + dyingc: dyingc, |
211 | + } |
212 | + }, |
213 | + getMachineFunc: func(id string) (machine, error) { |
214 | + c.Check(id, gc.Equals, m.id) |
215 | + return m, nil |
216 | + }, |
217 | + } |
218 | + watcher := &testMachinesWatcher{ |
219 | + changes: make(chan []string), |
220 | + } |
221 | + done := make(chan error) |
222 | + go func() { |
223 | + done <- watchMachinesLoop(context, watcher) |
224 | + }() |
225 | + // Send a change to start the machineLoop; |
226 | + watcher.changes <- []string{"99"} |
227 | + select { |
228 | + case <-waitStatus: |
229 | + c.Fatalf("poller called Status") |
230 | + case <-time.After(coretesting.ShortWait): |
231 | + c.Logf("status not called") |
232 | + } |
233 | + close(context.dyingc) |
234 | + select { |
235 | + case err := <-done: |
236 | + c.Assert(err, gc.IsNil) |
237 | + case <-time.After(coretesting.LongWait): |
238 | + c.Fatalf("timed out waiting for watchMachinesLoop to terminate") |
239 | + } |
240 | + c.Assert(watcher.stopped, jc.IsTrue) |
241 | +} |
242 | + |
243 | type testUpdaterContext struct { |
244 | newMachineContextFunc func() machineContext |
245 | getMachineFunc func(id string) (machine, error) |
Reviewers: mp+214857_ code.launchpad. net,
Message:
Please take a look.
Description:
Noisy instance poller
The instance poller was trying to poll instances which
are not yet provisioned, creating lots of log noise.
This fixes that.
https:/ /code.launchpad .net/~wallyworl d/juju- core/instance- poller- noise/+ merge/214857
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/85770043/
Affected files (+25, -9 lines): instancepoller/ machine_ test.go instancepoller/ updater. go
A [revision details]
M worker/
M worker/
Index: [revision details] 20140408170048- h58307lijtftb3s u
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: worker/ instancepoller/ machine_ test.go instancepoller/ machine_ test.go' instancepoller/ machine_ test.go 2014-04-01 23:56:19 +0000 instancepoller/ machine_ test.go 2014-04-09 00:14:53 +0000 tervalWhenNoAdd ress(c *gc.C) { (&ShortPoll, 1*time.Millisecond) (&LongPoll, coretesting. LongWait) StatusStarted) StatusStarted)
=== modified file 'worker/
--- worker/
+++ worker/
@@ -61,24 +61,31 @@
func (s *machineSuite) TestShortPollIn
s.PatchValue
s.PatchValue
- count := countPolls(c, nil, "running", params.
+ count := countPolls(c, nil, "i1234", "running", params.
c.Assert(count, jc.GreaterThan, 2)
}
func (s *machineSuite) TestShortPollIn tervalWhenNoSta tus(c *gc.C) { (&ShortPoll, 1*time.Millisecond) (&LongPoll, coretesting. LongWait) StatusStarted) StatusStarted)
s.PatchValue
s.PatchValue
- count := countPolls(c, testAddrs, "", params.
+ count := countPolls(c, testAddrs, "i1234", "", params.
c.Assert(count, jc.GreaterThan, 2)
}
func (s *machineSuite) TestShortPollIn tervalWhenNotSt arted(c *gc.C) { (&ShortPoll, 1*time.Millisecond) (&LongPoll, coretesting. LongWait) StatusPending) StatusPending)
s.PatchValue
s.PatchValue
- count := countPolls(c, testAddrs, "pending", params.
+ count := countPolls(c, testAddrs, "i1234", "pending",
params.
c.Assert(count, jc.GreaterThan, 2)
}
+func (s *machineSuite) TestShortPollIn tervalWhenNotPr ovisioned( c *gc.C) { &ShortPoll, 1*time.Millisecond) &LongPoll, coretesting. LongWait) StatusPending) tervalExponent( c *gc.C) { (&ShortPoll, 1*time.Microsecond) (&LongPoll, coretesting. LongWait) ShortPoll, given that sleep will Log(float64( coretesting. ShortWait) /float64( ShortPoll) )/math. Log(ShortPollBa ckoff) StatusStarted) StatusStarted) ervalWh. ..
+ s.PatchValue(
+ s.PatchValue(
+ count := countPolls(c, testAddrs, "", "pending", params.
+ c.Assert(count, gc.Equals, 0)
+}
+
func (s *machineSuite) TestShortPollIn
s.PatchValue
s.PatchValue
@@ -89,7 +96,7 @@
// ShortPollBackoff of ShortWait/
// sleep for at least the requested interval.
maxCount :=
int(math.
+ 1)
- count := countPolls(c, nil, "", params.
+ count := countPolls(c, nil, "i1234", "", params.
c.Assert(count, jc.GreaterThan, 2)
c.Assert(count, jc.LessThan, maxCount)
c.Logf("actual count: %v; max %v", count, maxCount)
@@ -98,7 +105,7 @@
func (s *machineSuite) TestLongPollInt