~hazmat/pyjuju/var-run-mass-restart

« back to all changes in this revision

Viewing changes to juju/unit/tests/test_lifecycle.py

merge relation-hook-cache-race [r=jameinel,gz][f=1067013]

Fix relation-ids hook command to list only complete relations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
897
897
        self.write_hook(
898
898
            "start",
899
899
            '#!/bin/sh\n echo "hello world"\n')
900
 
        yield self.add_opposite_service_unit(self.states)
 
900
        blog_states = yield self.add_opposite_service_unit(self.states)
 
901
        yield blog_states['service_relations'][-1].add_unit_state(
 
902
            self.states['unit'])
 
903
 
901
904
        for i in range(1, 3):
902
 
            yield self.add_opposite_service_unit(
 
905
            blog_states = yield self.add_opposite_service_unit(
903
906
                (yield self.add_relation_service_unit_to_another_endpoint(
904
907
                        self.states,
905
908
                        RelationEndpoint(
906
909
                            "wordpress-%d" % i,
907
910
                            "client-server", "db", "client"))))
 
911
            yield blog_states['service_relations'][-1].add_unit_state(
 
912
                self.states['unit'])
908
913
 
909
914
        finished = self.wait_on_hook("app-relation-changed", 3)
910
915
        yield self.lifecycle.start()
1328
1333
        # Setup 5 different wordpress services, wordpress, wordpress-1
1329
1334
        # through wordpress-4 with one service unit each. Each of these
1330
1335
        # will be on the relation app:0 ... app:4
1331
 
        yield self.add_opposite_service_unit(self.states)
 
1336
        blog_states = yield self.add_opposite_service_unit(self.states)
 
1337
        yield blog_states['service_relations'][-1].add_unit_state(
 
1338
            self.states['unit'])
 
1339
 
1332
1340
        for i in range(1, 5):
1333
 
            yield self.add_opposite_service_unit(
 
1341
            blog_states = yield self.add_opposite_service_unit(
1334
1342
                (yield self.add_relation_service_unit_to_another_endpoint(
1335
1343
                        self.states,
1336
1344
                        RelationEndpoint(
1337
1345
                            "wordpress-%d" % i,
1338
1346
                            "client-server", "db", "client"))))
 
1347
            yield blog_states['service_relations'][-1].add_unit_state(
 
1348
                self.states['unit'])
 
1349
 
1339
1350
        yield self.lifecycle.start()
1340
1351
        yield self.wait_on_hook(
1341
1352
            sequence=["app-relation-joined", "app-relation-changed"])