[#136] Fix broken RabbitMQ queue names

The harvester command was still using the old ones.
Use specific ones for testing.
This commit is contained in:
amercader 2015-06-11 13:56:22 +01:00
parent 673dfc9882
commit 88d9ba0397
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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')(