~jimbaker/pyjuju/ssh-known_hosts

« back to all changes in this revision

Viewing changes to juju/control/tests/test_resolved.py

  • Committer: Gustavo Niemeyer
  • Date: 2011-09-16 00:37:59 UTC
  • mfrom: (348.1.13 the-big-renaming)
  • Revision ID: gustavo@niemeyer.net-20110916003759-bx3vsznroj4gv7w7
Merging the-big-renaming branch! Say hello to juju!

This is a massive change renaming and fixing several things
on the way. Unfortunately my day is finishing and I didn't
manage to get 100% of the tests passing, but there's very
few things broken right now, and I don't want to keep such
a massive change flying around.

We'll sort any details out tomorrow.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from twisted.internet.defer import inlineCallbacks, returnValue
2
2
from yaml import dump
3
3
 
4
 
from ensemble.control import main
5
 
from ensemble.control.tests.common import ControlToolTest
6
 
from ensemble.formula.tests.test_repository import RepositoryTestBase
7
 
 
8
 
from ensemble.state.service import RETRY_HOOKS, NO_HOOKS
9
 
from ensemble.state.tests.test_service import ServiceStateManagerTestBase
10
 
from ensemble.state.errors import ServiceStateNotFound
11
 
 
12
 
from ensemble.unit.workflow import UnitWorkflowState, RelationWorkflowState
13
 
from ensemble.unit.lifecycle import UnitRelationLifecycle
14
 
from ensemble.hooks.executor import HookExecutor
 
4
from juju.control import main
 
5
from juju.control.tests.common import ControlToolTest
 
6
from juju.charm.tests.test_repository import RepositoryTestBase
 
7
 
 
8
from juju.state.service import RETRY_HOOKS, NO_HOOKS
 
9
from juju.state.tests.test_service import ServiceStateManagerTestBase
 
10
from juju.state.errors import ServiceStateNotFound
 
11
 
 
12
from juju.unit.workflow import UnitWorkflowState, RelationWorkflowState
 
13
from juju.unit.lifecycle import UnitRelationLifecycle
 
14
from juju.hooks.executor import HookExecutor
15
15
 
16
16
 
17
17
class ControlResolvedTest(
21
21
    def setUp(self):
22
22
        yield super(ControlResolvedTest, self).setUp()
23
23
        config = {
24
 
            "ensemble": "environments",
25
24
            "environments": {"firstenv": {"type": "dummy"}}}
26
25
 
27
26
        self.write_config(dump(config))
53
52
                yield self.service_state_manager.get_service_state(
54
53
                    service_name)
55
54
            except ServiceStateNotFound:
56
 
                yield self.add_service_from_formula(service_name)
 
55
                yield self.add_service_from_charm(service_name)
57
56
 
58
57
        endpoint_pairs = yield self.service_state_manager.join_descriptors(
59
58
            *service_names)
100
99
    @inlineCallbacks
101
100
    def test_resolved(self):
102
101
        """
103
 
        'ensemble resolved <unit_name>' will schedule a unit for
 
102
        'juju resolved <unit_name>' will schedule a unit for
104
103
        retrying from an error state.
105
104
        """
106
105
        # Push the unit into an error state
124
123
    @inlineCallbacks
125
124
    def test_resolved_retry(self):
126
125
        """
127
 
        'ensemble resolved --retry <unit_name>' will schedule a unit
 
126
        'juju resolved --retry <unit_name>' will schedule a unit
128
127
        for retrying from an error state with a retry of hooks
129
128
        executions.
130
129
        """
148
147
    @inlineCallbacks
149
148
    def test_relation_resolved(self):
150
149
        """
151
 
        'ensemble relation <unit_name> <rel_name>' will schedule
 
150
        'juju relation <unit_name> <rel_name>' will schedule
152
151
        the broken unit relations for being resolved.
153
152
        """
154
153
        service_relation = yield self.get_named_service_relation(
184
183
    @inlineCallbacks
185
184
    def test_resolved_relation_some_already_resolved(self):
186
185
        """
187
 
        'ensemble resolved <service_name> <rel_name>' will mark
 
186
        'juju resolved <service_name> <rel_name>' will mark
188
187
        resolved all down units that are not already marked resolved.
189
188
        """
190
189
 
224
223
    @inlineCallbacks
225
224
    def test_resolved_relation_some_already_resolved_conflict(self):
226
225
        """
227
 
        'ensemble resolved <service_name> <rel_name>' will mark
 
226
        'juju resolved <service_name> <rel_name>' will mark
228
227
        resolved all down units that are not already marked resolved.
229
228
        """
230
229
 
258
257
    @inlineCallbacks
259
258
    def test_resolved_unknown_service(self):
260
259
        """
261
 
        'ensemble resolved <unit_name>' will report if a service is
 
260
        'juju resolved <unit_name>' will report if a service is
262
261
        invalid.
263
262
        """
264
263
        self.setup_exit(0)
271
270
    @inlineCallbacks
272
271
    def test_resolved_unknown_unit(self):
273
272
        """
274
 
        'ensemble resolved <unit_name>' will report if a unit is
 
273
        'juju resolved <unit_name>' will report if a unit is
275
274
        invalid.
276
275
        """
277
276
        self.setup_exit(0)
285
284
    @inlineCallbacks
286
285
    def test_resolved_unknown_unit_relation(self):
287
286
        """
288
 
        'ensemble resolved <unit_name>' will report if a relation is
 
287
        'juju resolved <unit_name>' will report if a relation is
289
288
        invalid.
290
289
        """
291
290
        self.setup_exit(0)
303
302
    @inlineCallbacks
304
303
    def test_resolved_already_running(self):
305
304
        """
306
 
        'ensemble resolved <unit_name>' will report if
 
305
        'juju resolved <unit_name>' will report if
307
306
        the unit is already running.
308
307
        """
309
308
        # Just verify we don't accidentally mark up another unit of the service
330
329
    @inlineCallbacks
331
330
    def test_resolved_already_resolved(self):
332
331
        """
333
 
        'ensemble resolved <unit_name>' will report if
 
332
        'juju resolved <unit_name>' will report if
334
333
        the unit is already resolved.
335
334
        """
336
335
        # Mark the unit as resolved and as in an error state.
364
363
    @inlineCallbacks
365
364
    def test_resolved_relation_already_running(self):
366
365
        """
367
 
        'ensemble resolved <unit_name> <rel_name>' will report
 
366
        'juju resolved <unit_name> <rel_name>' will report
368
367
        if the relation is already running.
369
368
        """
370
369
        service2 = yield self.service_state_manager.get_service_state(