def test_fire_callback_on_before_deployment_check(self, get_m):
        cluster = mock.MagicMock()
        cluster.extensions = ['ex1']
        fire_callback_on_before_deployment_check(cluster, mock.sentinel.nodes)

        ex1 = get_m.return_value[0]
        self.assertEqual('ex1', ex1.name)
        ex1.on_before_deployment_check.assert_called_once_with(
            cluster, mock.sentinel.nodes)
        ex2 = get_m.return_value[1]
        self.assertEqual('ex2', ex2.name)
        self.assertFalse(ex2.on_before_deployment_check.called)
    def test_fire_callback_on_before_deployment_check(self, get_m):
        cluster = mock.MagicMock()
        cluster.extensions = ['ex1']
        fire_callback_on_before_deployment_check(cluster, mock.sentinel.nodes)

        ex1 = get_m.return_value[0]
        self.assertEqual('ex1', ex1.name)
        ex1.on_before_deployment_check.assert_called_once_with(
            cluster, mock.sentinel.nodes)
        ex2 = get_m.return_value[1]
        self.assertEqual('ex2', ex2.name)
        self.assertFalse(ex2.on_before_deployment_check.called)
Exemple #3
0
    def test_check_volumes_and_disks_run_if_node_not_ready(self):
        self.node.status = 'discover'

        with mock.patch.object(
                VolumeManager,
                'check_disk_space_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster)

        self.assertEqual(check_mock.call_count, 1)

        with mock.patch.object(
                VolumeManager,
                'check_volume_sizes_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster)

        self.assertEqual(check_mock.call_count, 1)
Exemple #4
0
    def test_check_volumes_and_disks_do_not_run_if_node_ready(self):
        self.node.status = 'ready'

        with mock.patch.object(
                VolumeManager,
                'check_disk_space_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster)

        self.assertFalse(check_mock.called)

        with mock.patch.object(
                VolumeManager,
                'check_volume_sizes_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster)

        self.assertFalse(check_mock.called)
Exemple #5
0
    def test_check_volumes_and_disks_run_if_node_not_ready(self):
        self.node.status = 'discover'

        with mock.patch.object(
                VolumeManager,
                'check_disk_space_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster, [self.node])

        self.assertEqual(check_mock.call_count, 1)

        with mock.patch.object(
                VolumeManager,
                'check_volume_sizes_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster, [self.node])

        self.assertEqual(check_mock.call_count, 1)
Exemple #6
0
    def test_check_volumes_and_disks_do_not_run_if_node_ready(self):
        self.node.status = 'ready'

        with mock.patch.object(
                VolumeManager,
                'check_disk_space_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster, [self.node])

        self.assertFalse(check_mock.called)

        with mock.patch.object(
                VolumeManager,
                'check_volume_sizes_for_deployment') as check_mock:
            fire_callback_on_before_deployment_check(self.cluster, [self.node])

        self.assertFalse(check_mock.called)