Index: worker/uniter/filter_test.go |
=== modified file 'worker/uniter/filter_test.go' |
--- worker/uniter/filter_test.go 2013-05-02 15:55:42 +0000 |
+++ worker/uniter/filter_test.go 2013-06-11 00:58:34 +0000 |
@@ -266,6 +266,9 @@ |
} |
assertNoChange() |
+ // Set the charm URL to trigger config events. |
+ err = f.SetCharm(s.wpcharm.URL()) |
+ c.Assert(err, IsNil) |
assertChange := func() { |
s.State.Sync() |
select { |
@@ -276,34 +279,23 @@ |
} |
assertNoChange() |
} |
- |
- // Set the charm URL to trigger config events. |
- err = f.SetCharm(s.wpcharm.URL()) |
- c.Assert(err, IsNil) |
assertChange() |
- // Make sure the charm URL is set now. |
- s.unit.Refresh() |
- curl, ok := s.unit.CharmURL() |
- c.Assert(ok, Equals, true) |
- c.Assert(curl, DeepEquals, s.wpcharm.URL()) |
- |
// Change the config; new event received. |
- node, err := s.wordpress.Config() |
- c.Assert(err, IsNil) |
- node.Set("skill-level", 9001) |
- _, err = node.Write() |
- c.Assert(err, IsNil) |
+ changeConfig := func(title interface{}) { |
+ err := s.wordpress.UpdateConfigSettings(charm.Settings{ |
+ "blog-title": title, |
+ }) |
+ c.Assert(err, IsNil) |
+ } |
+ changeConfig("20,000 leagues in the cloud") |
assertChange() |
- // Change the config a couple of times, then reset the events. |
- node.Set("title", "20,000 leagues in the cloud") |
- _, err = node.Write() |
- c.Assert(err, IsNil) |
- node.Set("outlook", "precipitous") |
- _, err = node.Write() |
- c.Assert(err, IsNil) |
- // We make sure the event has come into the filter before we tell it to discard any received. |
+ // Change the config a few more times, then reset the events. We sync to |
+ // make sure the event has come into the filter before we tell it to discard |
+ // all received events. |
+ changeConfig(nil) |
+ changeConfig("the curious incident of the dog in the cloud") |
s.State.Sync() |
f.DiscardConfigEvent() |
assertNoChange() |
@@ -318,12 +310,8 @@ |
assertNoChange() |
// Further changes are still collapsed as appropriate. |
- node.Set("skill-level", 123) |
- _, err = node.Write() |
- c.Assert(err, IsNil) |
- node.Set("outlook", "expressive") |
- _, err = node.Write() |
- c.Assert(err, IsNil) |
+ changeConfig("forsooth") |
+ changeConfig("imagination failure") |
assertChange() |
} |