Skip to content

Commit

Permalink
Clears redis db before queue test
Browse files Browse the repository at this point in the history
Makes the test independent of the test execution order
Prevents the test from failing on a server that is not freshly installed
  • Loading branch information
seitenbau-govdata committed Nov 22, 2021
1 parent a934f27 commit d2cf517
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckanext/harvest/tests/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class TestHarvestQueue(object):

def test_01_basic_harvester(self):

if config.get('ckan.harvest.mq.type') == 'redis':
# make sure that there are no old elements in the redis db
redis = queue.get_connection()
redis.flushdb()

# make sure queues/exchanges are created first and are empty
consumer = queue.get_gather_consumer()
consumer_fetch = queue.get_fetch_consumer()
Expand Down Expand Up @@ -257,6 +262,7 @@ def test_resubmit_objects(self):
'''
if config.get('ckan.harvest.mq.type') != 'redis':
pytest.skip()
# make sure that there are no old elements in the redis db
redis = queue.get_connection()
fetch_routing_key = queue.get_fetch_routing_key()
redis.flushdb()
Expand Down

0 comments on commit d2cf517

Please sign in to comment.