Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(38)

Unified Diff: worker/uniter/filter_test.go

Issue 10083047: state: Service ConfigSettings methods
Patch Set: state: Service ConfigSettings methods Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « worker/uniter/context_test.go ('k') | worker/uniter/uniter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
}
« no previous file with comments | « worker/uniter/context_test.go ('k') | worker/uniter/uniter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b