~fwereade/pyjuju/cobbler-zk-connect

« back to all changes in this revision

Viewing changes to ensemble/control/tests/test_deploy.py

  • Committer: William Reade
  • Date: 2011-08-25 16:41:03 UTC
  • mfrom: (306.1.24 ensemble)
  • Revision ID: fwereade@gmail.com-20110825164103-1ozdy4eflq5qt3bo
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
        self.mocker.replay()
156
156
        self.mocker.result(succeed(True))
157
157
 
158
 
        self.capture_stream('stderr')
 
158
        self.capture_stream("stderr")
159
159
        main(["deploy", "--environment", "secondenv", "--repository",
160
160
              self.unbundled_repo_path, "sample"])
161
161
 
245
245
    def test_deploy_with_config(self):
246
246
        """Valid config options should be available to the deployed
247
247
        service."""
248
 
        config_file = self.makeFile(yaml.dump(dict(myblog=dict(application_file="foo"))))
 
248
        config_file = self.makeFile(yaml.dump(dict(
 
249
                    myblog=dict(outlook="sunny",
 
250
                                username="tester01"))))
249
251
        environment = self.config.get("firstenv")
250
252
 
251
253
        yield deploy.deploy(self.config, environment, self.unbundled_repo_path,
252
 
                            "sample", "myblog", logging.getLogger("deploy"),
 
254
                            "dummy", "myblog", logging.getLogger("deploy"),
253
255
                            config_file)
254
256
 
255
257
        # Verify that options in the yaml are available as state after
256
258
        # the deploy call (successfully applied)
257
259
        service = yield ServiceStateManager(self.client).get_service_state("myblog")
258
260
        config = yield service.get_config()
259
 
        self.assertEqual(config["application_file"], "foo")
 
261
        self.assertEqual(config["outlook"], "sunny")
 
262
        self.assertEqual(config["username"], "tester01")
 
263
        # a default value from the config.yaml
 
264
        self.assertEqual(config["title"], "My Title")
 
265
 
 
266
    @inlineCallbacks
 
267
    def test_deploy_with_default_config(self):
 
268
        """Valid config options should be available to the deployed
 
269
        service."""
 
270
        environment = self.config.get("firstenv")
 
271
 
 
272
        # Here we explictly pass no config file but the services
 
273
        # associated config.yaml defines default which we expect to
 
274
        # find anyway.
 
275
        yield deploy.deploy(self.config, environment, self.unbundled_repo_path,
 
276
                            "dummy", "myblog", logging.getLogger("deploy"),
 
277
                            None)
 
278
 
 
279
        # Verify that options in the yaml are available as state after
 
280
        # the deploy call (successfully applied)
 
281
        service = yield ServiceStateManager(self.client).get_service_state("myblog")
 
282
        config = yield service.get_config()
 
283
        self.assertEqual(config["title"], "My Title")
260
284
 
261
285
    @inlineCallbacks
262
286
    def test_deploy_adds_peer_relations(self):