~bcsaller/pyjuju/subordinate-removes

« back to all changes in this revision

Viewing changes to juju/state/tests/test_firewall.py

  • Committer: Benjamin Saller
  • Date: 2012-04-25 19:18:35 UTC
  • Revision ID: bcsaller@gmail.com-20120425191835-15xooxkgynsy5o29
wip

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
        self.stop()
186
186
 
187
187
    @inlineCallbacks
 
188
    def test_open_close_ports_subordinate(self):
 
189
        """Verify that opening/closing ports triggers the appropriate firewall
 
190
        management for the corresponding service units.
 
191
 
 
192
        """
 
193
        service_states, relation_state, unit_states = (
 
194
            yield self.setup_subordinate_defaults())
 
195
        (logging0, _), (logging1, _) = unit_states
 
196
        logging = yield logging0.get_service_state()
 
197
        yield logging.set_exposed_flag()
 
198
 
 
199
        self.start()
 
200
        expected_units = self.wait_on_expected_units(
 
201
            set(["logging/0"]))
 
202
 
 
203
        yield logging0.open_port(443, "tcp")
 
204
        yield logging0.open_port(80, "tcp")
 
205
        yield logging0.close_port(443, "tcp")
 
206
        self.assertTrue((yield expected_units))
 
207
 
 
208
        expected_units = self.wait_on_expected_units(
 
209
            set(["logging/0", "logging/1"]))
 
210
        yield logging0.open_port(53, "udp")
 
211
        yield logging1.open_port(80, "tcp")
 
212
        self.assertTrue((yield expected_units))
 
213
 
 
214
        expected_units = self.wait_on_expected_units(
 
215
            set(["logging/0", "logging/1"]))
 
216
        yield logging.clear_exposed_flag()
 
217
        self.assertTrue((yield expected_units))
 
218
        self.stop()
 
219
 
 
220
    @inlineCallbacks
188
221
    def test_remove_service_state(self):
189
222
        """Verify that firewall mgmt for corresponding service units
190
223
        is triggered upon the service's removal.