Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ jobs:
BUS_URL: amqp://guest:guest@${{ github.server_url != 'https://github.com' && 'rabbitmq' || 'localhost' }}
run: |
pip install coverage
coverage run -m unittest tests/**/*.py
coverage run -m unittest tests/*.py
coverage report -m --fail-under=60
2 changes: 1 addition & 1 deletion servc/svc/com/storage/lake.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _get_table_name(self) -> str:
name_w_medallion = self._table
else:
name_w_medallion = "".join(
[self._table["medallion"].value, "-", self._table["name"]]
[self._table["medallion"].value, "_", self._table["name"]]
)

return ".".join([schema, name_w_medallion])
Expand Down
8 changes: 4 additions & 4 deletions servc/svc/com/worker/hooks/parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def evaluate_part_pre_hook(

jobs = resolvers[part_method](message["id"], artifact, context)
if not isinstance(jobs, list):
print(f"Resolver {part_method} did not return a list")
return True
raise Exception(f"Resolver {part_method} did not return a list")

# formulate on complete hook
complete_hook: List[OnCompleteHook] = []
Expand All @@ -84,8 +83,9 @@ def evaluate_part_pre_hook(
complete_hook.append(newHook)

# create task queue
task_queue = f"part.{route}-{method}-{message['id']}"
bus.create_queue(task_queue, False)
if len(jobs):
task_queue = f"part.{route}-{method}-{message['id']}"
bus.create_queue(task_queue, False)

# publish messages to part queue
payload_template: InputPayload = {
Expand Down
23 changes: 23 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import json


def get_route_message(channel, cache, route, deleteRoute=False):
queue = channel.queue_declare(
queue=route,
passive=True,
durable=True,
exclusive=False,
auto_delete=False,
)
count = queue.method.message_count
body = None

if count:
_m, _h, body = channel.basic_get(route)
if deleteRoute:
channel.queue_delete(queue=route)
if body:
body = json.loads(body.decode("utf-8"))
if "argumentId" in body:
body["argument"] = cache.getKey(body["argumentId"])
return body, count
23 changes: 0 additions & 23 deletions tests/hooks/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/hooks/test_complete.py → tests/test_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from servc.svc.config import Config
from servc.svc.io.hooks import CompleteHookType
from servc.svc.io.input import ArgumentArtifact, InputPayload, InputType
from tests.hooks import get_route_message
from tests import get_route_message

message: InputPayload = {
"id": "123",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/lake/test_iceberg.py → tests/test_iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_connect(self):
self.assertTrue(self.iceberg.isOpen)

def test_name(self):
self.assertEqual(self.iceberg.tablename, "default.bronze-test")
self.assertEqual(self.iceberg.tablename, "default.bronze_test")

def test_insert(self):
self.iceberg.overwrite([])
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_load_from_catalog(self):
self.iceberg.insert([{"date": "2021-01-01", "some_int": 1}])
orig_data = self.iceberg.read(["date"]).to_pylist()

iceberg = IceBerg(config, "default.bronze-test")
iceberg = IceBerg(config, "default.bronze_test")
iceberg._connect()
self.assertTrue(iceberg.isOpen)

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions tests/hooks/test_parallelize.py → tests/test_parallelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ def test_non_list_partifier(self):
}

# true because resolver did not return a list
res = evaluate_part_pre_hook(new_mapping, message, art2, self.context)
self.assertTrue(res)
self.assertRaises(
Exception,
lambda: evaluate_part_pre_hook(new_mapping, message, art2, self.context),
)

def test_w_on_complete_hook(self):
self.bus._route = "test"
Expand Down
File renamed without changes.
File renamed without changes.
Loading