Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for message bus #542

Merged
merged 1 commit into from
Feb 28, 2018

Conversation

hluk
Copy link
Contributor

@hluk hluk commented Feb 27, 2018


Maybe it can be handled more directly by overriding pdc.apps.utils.messenger in settings_tests.py. Not sure which solution is cleaner.

This is just single simple test, or more like proof of concept. It doesn't seem the message format is documented anywhere.

Perhaps this is enough for PDC-2583?

@hluk hluk requested a review from lubomir February 27, 2018 13:26
Copy link
Member

@lubomir lubomir left a comment

Choose a reason for hiding this comment

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

For PDC-2583 I meant a message producer that would be usable with manage.py runserver and printing the messages (instead of basically dropping them which is what the dummy messenger does).

messenger = MESSENGERS.get(settings.MESSAGE_BUS['MLP'], DummyMessenger)()

def _init_messenger():
mpl = settings.MESSAGE_BUS['MLP']
Copy link
Member

Choose a reason for hiding this comment

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

I think MPL stands for Messaging Library Provider. mpl looks like a typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's typo.

listener.messages.append((topic, msg))

def listen(self):
return TestListener(self)
Copy link
Member

Choose a reason for hiding this comment

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

Should these two classes really be in the settings file? Maybe a comment explaining why would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could add special value "test" for the settings.MESSAGE_BUS['MLP'] and move the classes to pdc/apps/utils/messaging.py. That way I don't have to modify how the global messenger variable is initiated.

@hluk hluk merged commit 47e3434 into product-definition-center:master Feb 28, 2018
@hluk hluk deleted the test-message-bus branch February 28, 2018 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants