From 88d9ba03973a79bbe2c124f8c7c6633b1d70dd42 Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 11 Jun 2015 13:56:22 +0100 Subject: [PATCH] [#136] Fix broken RabbitMQ queue names The harvester command was still using the old ones. Use specific ones for testing. --- ckanext/harvest/commands/harvester.py | 10 ++++++---- ckanext/harvest/tests/test_queue.py | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ckanext/harvest/commands/harvester.py b/ckanext/harvest/commands/harvester.py index ba546fe..975c653 100644 --- a/ckanext/harvest/commands/harvester.py +++ b/ckanext/harvest/commands/harvester.py @@ -127,17 +127,19 @@ class Harvester(CkanCommand): self.run_harvester() elif cmd == 'gather_consumer': import logging - from ckanext.harvest.queue import get_gather_consumer, gather_callback + from ckanext.harvest.queue import (get_gather_consumer, + gather_callback, get_gather_queue_name) logging.getLogger('amqplib').setLevel(logging.INFO) consumer = get_gather_consumer() - for method, header, body in consumer.consume(queue='ckan.harvest.gather'): + for method, header, body in consumer.consume(queue=get_gather_queue_name()): gather_callback(consumer, method, header, body) elif cmd == 'fetch_consumer': import logging logging.getLogger('amqplib').setLevel(logging.INFO) - from ckanext.harvest.queue import get_fetch_consumer, fetch_callback + from ckanext.harvest.queue import (get_fetch_consumer, fetch_callback, + get_fetch_queue_name) consumer = get_fetch_consumer() - for method, header, body in consumer.consume(queue='ckan.harvest.fetch'): + for method, header, body in consumer.consume(queue=get_fetch_queue_name()): fetch_callback(consumer, method, header, body) elif cmd == 'purge_queues': from ckanext.harvest.queue import purge_queues diff --git a/ckanext/harvest/tests/test_queue.py b/ckanext/harvest/tests/test_queue.py index 4e0e602..2b06926 100644 --- a/ckanext/harvest/tests/test_queue.py +++ b/ckanext/harvest/tests/test_queue.py @@ -92,10 +92,10 @@ class TestHarvestQueue(object): def test_01_basic_harvester(self): ### make sure queues/exchanges are created first and are empty - consumer = queue.get_consumer('ckan.harvest.gather','harvest_job_id') - consumer_fetch = queue.get_consumer('ckan.harvest.fetch','harvest_object_id') - consumer.queue_purge(queue='ckan.harvest.gather') - consumer_fetch.queue_purge(queue='ckan.harvest.fetch') + consumer = queue.get_consumer('ckan.harvest.test.gather', 'harvest_job_id') + consumer_fetch = queue.get_consumer('ckan.harvest.test.fetch', 'harvest_object_id') + consumer.queue_purge(queue='ckan.harvest.test.gather') + consumer_fetch.queue_purge(queue='ckan.harvest.test.fetch') user = logic.get_action('get_site_user')(