Ejemplo n.º 1
0
    def test_get_task(self):
        """Test getting a task from the upload queue"""
        b = BossBackend(self.example_config_data)
        b.setup(self.api_token)

        # Make sure queue is empty.
        sqs = boto3.resource('sqs')
        queue = sqs.Queue(self.upload_queue_url)
        queue.purge()

        # Put some stuff on the task queue
        self.setup_helper.add_tasks(self.aws_creds["access_key"],
                                    self.aws_creds['secret_key'],
                                    self.upload_queue_url, b)

        # Join and get a task
        b.join(23)
        msg_id, rx_handle, msg_body = b.get_task()

        assert isinstance(msg_id, str)
        assert isinstance(rx_handle, str)
        assert msg_body == self.setup_helper.test_msg[0]

        msg_id, rx_handle, msg_body = b.get_task()
        assert isinstance(msg_id, str)
        assert isinstance(rx_handle, str)
        assert msg_body == self.setup_helper.test_msg[1]
Ejemplo n.º 2
0
    def test_delete_task(self):
        b = BossBackend(self.example_config_data)
        b.setup(self.api_token)

        # Make sure queue is empty.
        sqs = boto3.resource('sqs')
        queue = sqs.Queue(self.upload_queue_url)
        queue.purge()

        # Put some stuff on the task queue
        self.setup_helper.add_tasks(self.aws_creds["access_key"],
                                    self.aws_creds['secret_key'],
                                    self.upload_queue_url, b)

        # Join and get a task
        b.join(23)
        msg_id, rx_handle, msg_body = b.get_task()

        assert b.delete_task(msg_id, rx_handle)
Ejemplo n.º 3
0
    def test_join(self):
        """Test joining an existing ingest job - mock server response"""
        b = BossBackend(self.example_config_data)
        b.setup(self.api_token)

        status, creds, queue_url, tile_bucket, params, tile_count = b.join(23)

        assert b.queue.url == self.queue_url
        assert status == 1
        assert creds == self.aws_creds
        assert queue_url == self.queue_url
        assert tile_bucket == self.tile_bucket_name
        assert tile_count == 500
        assert 'KVIO_SETTINGS' in params
        assert 'OBJECTIO_CONFIG' in params
        assert 'STATEIO_CONFIG' in params
        assert 'ingest_queue' in params