Skip to content

Commit

Permalink
fix: Typo in function name (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin1111 authored Dec 24, 2024
1 parent 5c50c5f commit fbeffd4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion producer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def produce(pg_host, pg_port, pg_database, pg_user, pg_password, pg_replication_
@click.option('--pg_publication_name', default=lambda: os.environ.get('PGPUBLICATION', None), required=False, help='Restrict to specific publications e.g. events')
@click.option('--rabbitmq_url', default=lambda: os.environ.get('RABBITMQ_URL', None), required=True, help='RabbitMQ url ($RABBITMQ_URL)')
@click.option('--rabbitmq_exchange', default=lambda: os.environ.get('RABBITMQ_EXCHANGE', None), required=True, help='RabbitMQ exchange ($RABBITMQ_EXCHANGE)')
def produce_multiple_dbs(db_configs, pg_output_plugin, pg_publication_name, rabbitmq_url, rabbitmq_exchange):
def producer_multiple_dbs(db_configs, pg_output_plugin, pg_publication_name, rabbitmq_url, rabbitmq_exchange):
try:
db_configs = json.loads(db_configs)
validate_db_configs(db_configs)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
entry_points='''
[console_scripts]
producer=producer.main:produce
producer_multiple_dbs=producer.main:produce_multiple_dbs
producer_multiple_dbs=producer.main:producer_multiple_dbs
event_logger=consumer.main:consume
'''
)
18 changes: 9 additions & 9 deletions tests/test_event_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from common.qconnector.rabbitmq_connector import RabbitMQConnector
from common.utils import validate_db_configs
from producer.event_producer import EventProducer
from producer.main import produce_multiple_dbs
from producer.main import producer_multiple_dbs


# Test init
Expand Down Expand Up @@ -242,19 +242,19 @@ def valid_db_configs():
'pg_replication_slot': 'events'
}])

def test_produce_multiple_dbs_success(valid_db_configs):
def test_producer_multiple_dbs_success(valid_db_configs):
runner = CliRunner()
result = runner.invoke(produce_multiple_dbs, [
result = runner.invoke(producer_multiple_dbs, [
'--db_configs', valid_db_configs,
'--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0',
'--rabbitmq_exchange', 'pgevents_exchange'
])

assert result.exit_code == 0

def test_produce_multiple_dbs_invalid_json():
def test_producer_multiple_dbs_invalid_json():
runner = CliRunner()
result = runner.invoke(produce_multiple_dbs, [
result = runner.invoke(producer_multiple_dbs, [
'--db_configs', 'invalid-json',
'--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0',
'--rabbitmq_exchange', 'pgevents_exchange'
Expand All @@ -263,21 +263,21 @@ def test_produce_multiple_dbs_invalid_json():
assert "db_configs must be a valid JSON string" in str(result.__dict__)

@mock.patch('producer.main.validate_db_configs')
def test_produce_multiple_dbs_invalid_config(mock_validate, valid_db_configs):
def test_producer_multiple_dbs_invalid_config(mock_validate, valid_db_configs):
mock_validate.side_effect = click.BadParameter("Invalid config")

runner = CliRunner()
result = runner.invoke(produce_multiple_dbs, [
result = runner.invoke(producer_multiple_dbs, [
'--db_configs', valid_db_configs,
'--rabbitmq_url', 'amqp://admin:password@rabbitmq:5672/?heartbeat=0',
'--rabbitmq_exchange', 'pgevents_exchange'
])

assert "Invalid config" in str(result.__dict__)

def test_produce_multiple_dbs_common_kwargs(valid_db_configs):
def test_producer_multiple_dbs_common_kwargs(valid_db_configs):
runner = CliRunner()
result = runner.invoke(produce_multiple_dbs, [
result = runner.invoke(producer_multiple_dbs, [
'--db_configs', valid_db_configs,
'--pg_output_plugin', 'test_plugin',
'--pg_publication_name', 'test_pub',
Expand Down

1 comment on commit fbeffd4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
common
   compression.py5180%9
   log.py90100% 
   utils.py280100% 
common/qconnector
   rabbitmq_connector.py451371%23–24, 37–49, 52–65
consumer
   event_consumer.py340100% 
pgoutput_parser
   base.py610100% 
   delete.py140100% 
   insert.py150100% 
   relation.py270100% 
   update.py190100% 
producer
   event_producer.py1481590%118–122, 215–217, 223–224, 245, 248–252
TOTAL4052993% 

Tests Skipped Failures Errors Time
30 0 💤 0 ❌ 0 🔥 0.272s ⏱️

Please sign in to comment.