def test_migrate_partition_skips_missing_destinations(self):
        del config.DESTINATIONS['crate_m']

        partition_val = 13
        source_shard = 'shn'
        destination_shard = 'crate'
        configs = [
            worker.ChunkConfig('mid', data.TableConfig('TableA', 'filter_col_a', 'chunk_col_a', None), None, partition_val,
                               '', source_shard, destination_shard, None, None, None,
                               'mysql', 'crate'),

            worker.ChunkConfig('mid', data.TableConfig('TableB', 'filter_col_b', 'chunk_col_b', None), None, partition_val,
                               '', source_shard, destination_shard, None, None, None,
                               'mysql', 'crate'),

            worker.ChunkConfig('mid', data.TableConfig('WTableA', 'w_filter_col_a', 'w_chunk_col_a', None), None,
                               partition_val,
                               '', source_shard + '_w', destination_shard + '_w', None, None, None,
                               'mysql_w', 'crate_w'),

            worker.ChunkConfig('mid', data.TableConfig('WTableB', 'w_filter_col_b', 'w_chunk_col_b', None), None,
                               partition_val,
                               '', source_shard + '_w', destination_shard + '_w', None, None, None,
                               'mysql_w', 'crate_w'),
        ]
        self.expected_configs(configs)

        namespace = ''

        self.mox.ReplayAll()
        queuer.migrate_partition(partition_val, namespace, source_shard, destination_shard)
    def test_migrate_partition_namespace(self):
        partition_val = 13
        source_shard = 'shn'
        destination_shard = 'crate'
        namespace = 'ns'
        configs = [
            worker.ChunkConfig('mid', data.TableConfig('TableA', 'filter_col_a', 'chunk_col_a', None), None, partition_val,
                               'ns', source_shard, destination_shard, None, None, None,
                               'ns', 'ns'),

            worker.ChunkConfig('mid', data.TableConfig('TableB', 'filter_col_b', 'chunk_col_b', None), None, partition_val,
                               'ns', source_shard, destination_shard, None, None, None,
                               'ns', 'ns'),

            worker.ChunkConfig('mid', data.TableConfig('WTableA', 'w_filter_col_a', 'w_chunk_col_a', None), None,
                               partition_val,
                               'ns_w', source_shard + '_w', destination_shard + '_w', None, None, None,
                               'ns_w', 'ns_w'),

            worker.ChunkConfig('mid', data.TableConfig('WTableB', 'w_filter_col_b', 'w_chunk_col_b', None), None,
                               partition_val,
                               'ns_w', source_shard + '_w', destination_shard + '_w', None, None, None,
                               'ns_w', 'ns_w'),

            worker.ChunkConfig('mid', data.TableConfig('MTableA', 'm_filter_col_a', 'm_chunk_col_a', None), None,
                               partition_val,
                               'ns_m', source_shard + '_m', destination_shard + '_m', None, None, None,
                               'ns_m', 'ns_m'),

            worker.ChunkConfig('mid', data.TableConfig('MTableB', 'm_filter_col_b', 'm_chunk_col_b', None), None,
                               partition_val,
                               'ns_m', source_shard + '_m', destination_shard + '_m', None, None, None,
                               'ns_m', 'ns_m'),
        ]
        self.expected_configs(configs)

        self.mox.ReplayAll()
        queuer.migrate_partition(partition_val, namespace, source_shard, destination_shard)