Exemplo n.º 1
0
    def test_that_table_backup_is_scheduled_for_not_partitioned_table(
            self, backup_start, _, _1):
        # given
        table_reference = TableReference(project_id="test-project",
                                         dataset_id="test-dataset",
                                         table_id="test-table",
                                         partition_id=None)
        # when
        TableBackup.start(table_reference)

        # then
        backup_start.assert_called_once()
Exemplo n.º 2
0
    def test_that_backup_are_scheduled_for_non_empty_single_partition(
            self, _, _1, _2, _3, backup_start):
        # given
        table_reference = TableReference(project_id="test-project",
                                         dataset_id="test-dataset",
                                         table_id="test-table",
                                         partition_id="20170303")

        # when
        TableBackup.start(table_reference)

        # then
        backup_start.assert_called_once()
Exemplo n.º 3
0
    def test_that_backup_for_partitions_is_scheduled_for_empty_partitioned_table(
            self, table_partitions_backup_scheduler, _, _1, _2, _3):
        # given
        table_reference = TableReference(project_id="test-project",
                                         dataset_id="test-dataset",
                                         table_id="test-table",
                                         partition_id=None)

        # when
        TableBackup.start(table_reference)

        # then
        table_partitions_backup_scheduler.assert_called_once()
Exemplo n.º 4
0
    def test_that_backup_for_partitions_is_scheduled_for_partitioned_table(
            self, _, _1, _2, _3, _4):
        # given
        table_reference = TableReference(project_id="test-project",
                                         dataset_id="test-dataset",
                                         table_id="test-table",
                                         partition_id=None)

        # when
        TableBackup.start(table_reference)

        # then
        tasks = self.task_queue_stub.get_filtered_tasks(
            queue_names='backup-scheduler')

        self.assertEqual(len(tasks), 1)
        self.assertEqual(
            tasks[0].payload,
            'projectId=test-project&tableId=test-table&datasetId=test-dataset')
Exemplo n.º 5
0
 def get(self, project_id, dataset_id, table_id, partition_id=None): # nopep8 pylint: disable=R0201
     table_reference = TableReference(project_id, dataset_id,
                                      urllib2.unquote(table_id), partition_id)
     TableBackup.start(table_reference)