def test_data_relation_changed_waits_for_data_relation_mountpoint(self):
     """
     C{data_relation_changed} will wait for the storage charm to respond
     with the properly configured C{mountpoint} in the 'data' relation
     before calling C{config_changed}.
     """
     mount = hooks.external_volume_mount
     hooks.hookenv._config["storage_mount_point"] = mount
     self.assertEqual(hooks.hookenv._incoming_relation_data, ())
     hooks.data_relation_changed()
     message = "Waiting for mountpoint from the relation: %s" % mount
     self.assertIn(
         message, hooks.hookenv._log_DEBUG, "Not logged- %s" % message)
Exemple #2
0
 def test_data_relation_changed_waits_for_data_relation_mountpoint(self):
     """
     C{data_relation_changed} will wait for the storage charm to respond
     with the properly configured C{mountpoint} in the 'data' relation
     before calling C{config_changed}.
     """
     mount = hooks.external_volume_mount
     hooks.hookenv._config["storage_mount_point"] = mount
     self.assertEqual(hooks.hookenv._incoming_relation_data, ())
     hooks.data_relation_changed()
     message = "Waiting for mountpoint from the relation: %s" % mount
     self.assertIn(message, hooks.hookenv._log_DEBUG,
                   "Not logged- %s" % message)
Exemple #3
0
    def test_data_relation_changed_mountpoint_present(self):
        """
        C{data_relation_changed} will call C{config_changed} when it receives
        the successfuly mounted C{mountpoint} from storage charm.
        """
        mount = hooks.external_volume_mount
        self.addCleanup(setattr, hooks.hookenv, "_incoming_relation_data", ())
        hooks.hookenv._incoming_relation_data = (("mountpoint", mount), )
        config_changed = self.mocker.replace(hooks.config_changed)
        config_changed(mount_point=mount)
        self.mocker.replay()

        hooks.data_relation_changed()
        message = "Storage ready and mounted"
        self.assertIn(message, hooks.hookenv._log_DEBUG,
                      "Not logged- %s" % message)
    def test_data_relation_changed_mountpoint_present(self):
        """
        C{data_relation_changed} will call C{config_changed} when it receives
        the successfuly mounted C{mountpoint} from storage charm.
        """
        mount = hooks.external_volume_mount
        self.addCleanup(
            setattr, hooks.hookenv, "_incoming_relation_data", ())
        hooks.hookenv._incoming_relation_data = (("mountpoint", mount),)
        config_changed = self.mocker.replace(hooks.config_changed)
        config_changed(mount_point=mount)
        self.mocker.replay()

        hooks.data_relation_changed()
        message = "Storage ready and mounted"
        self.assertIn(
            message, hooks.hookenv._log_DEBUG, "Not logged- %s" % message)