Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #131 from Clariteia/0.0.2
Browse files Browse the repository at this point in the history
0.0.2
  • Loading branch information
andrea-mucci authored May 17, 2021
2 parents fda20b8 + 3b9efdf commit 1b07e01
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 41 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
MINOS_COMMANDS_BROKER: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres
MINOS_SAGA_QUEUE_HOST: postgres

steps:
- name: Check out repository code
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ History
* Added Command Broker with Recurrent Service
* Added REST Service with Health handler

0.0.2 (2021-05-17)
------------------

* Completed the Poetry Support
* added actions for documentation
2 changes: 1 addition & 1 deletion minos/networks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Minos framework can not be copied and/or distributed without the express permission of Clariteia SL.
"""
__version__ = "0.0.1"
__version__ = "0.0.2"

from .broker import (
MinosCommandBroker,
Expand Down
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "minos_microservice_network"
version = "0.0.1"
version = "0.0.2"
description = "Python Package with the common network classes and utilities used in Minos Microservice."
readme = "README.md"
repository = "https://github.com/clariteia/minos_microservice_network"
Expand Down Expand Up @@ -31,7 +31,7 @@ include = [

[tool.poetry.dependencies]
python = "^3.9"
minos-microservice-common = "^0.0.11"
minos-microservice-common = "^0.0.12"
aiokafka = "^0.7.0"
aiomisc = "^14.0.3"
aiopg = "^1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ saga:
database: order_db
user: minos
password: min0s
host: postgres
host: localhost
port: 5432
records: 10
retry: 2
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ def test_from_config(self):
async def test_if_queue_table_exists(self):
handler = MinosCommandReplyHandlerDispatcher.from_config(config=self.config)
await handler.setup()
self._meta_saga_queue_db = self._config.saga.queue._asdict()
self._meta_saga_queue_db.pop("records")
self._meta_saga_queue_db.pop("retry")
async with aiopg.connect(**self._meta_saga_queue_db) as connect:

async with aiopg.connect(**self.saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute(
"SELECT 1 "
Expand Down Expand Up @@ -88,17 +86,9 @@ async def test_none_config(self):
self.assertIsNone(handler)

async def test_event_queue_checker(self):
self._meta_saga_queue_db = self._config.saga.queue._asdict()
self._meta_saga_queue_db.pop("records")
self._meta_saga_queue_db.pop("retry")

handler = MinosCommandReplyHandlerDispatcher.from_config(config=self.config)
await handler.setup()

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute("DELETE FROM {table};".format(table=MinosCommandReplyHandlerDispatcher.TABLE))

model = NaiveAggregate(test_id=1, test=2, id=1, version=1)
instance = CommandReply(
topic="AddOrder",
Expand All @@ -111,7 +101,7 @@ async def test_event_queue_checker(self):
bin_data = instance.avro_bytes
CommandReply.from_avro_bytes(bin_data)

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with aiopg.connect(**self.saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute(
"INSERT INTO command_reply_queue (topic, partition_id, binary_data, creation_date) "
Expand All @@ -129,28 +119,20 @@ async def test_event_queue_checker(self):
# Must get the record, call on_reply function and delete the record from DB
await handler.queue_checker()

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with aiopg.connect(**self.saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute("SELECT COUNT(*) FROM command_reply_queue WHERE id=%d" % (queue_id))
records = await cur.fetchone()

assert records[0] == 0

async def test_command_reply_queue_checker_wrong_event(self):
self._meta_saga_queue_db = self._config.saga.queue._asdict()
self._meta_saga_queue_db.pop("records")
self._meta_saga_queue_db.pop("retry")

handler = MinosCommandReplyHandlerDispatcher.from_config(config=self.config)
await handler.setup()

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute("DELETE FROM {table};".format(table=MinosCommandReplyHandlerDispatcher.TABLE))

bin_data = bytes(b"Test")

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with aiopg.connect(**self.saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute(
"INSERT INTO command_reply_queue (topic, partition_id, binary_data, creation_date) "
Expand All @@ -168,7 +150,7 @@ async def test_command_reply_queue_checker_wrong_event(self):
# Must get the record, call on_reply function and delete the record from DB
await handler.queue_checker()

async with aiopg.connect(**self._meta_saga_queue_db) as connect:
async with aiopg.connect(**self.saga_queue_db) as connect:
async with connect.cursor() as cur:
await cur.execute("SELECT COUNT(*) FROM command_reply_queue WHERE id=%d" % (queue_id))
records = await cur.fetchone()
Expand Down

0 comments on commit 1b07e01

Please sign in to comment.