Skip to content

Commit 05a4e5f

Browse files
author
Arik Kfir
committed
Fix tets.
1 parent 7433616 commit 05a4e5f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tests/mock_external_services.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def find_k8s_namespace_object(self, manifest: dict) -> Union[None, dict]:
233233
key = f"{api_version}-{kind}-{namespace}-{name}"
234234
return self._k8s_objects[key] if key in self._k8s_objects else None
235235

236-
def create_k8s_object(self, manifest: dict, timeout: int = 60 * 5) -> None:
236+
def create_k8s_object(self, manifest: dict, timeout: int = 60 * 5, verbose: bool = True) -> None:
237237
api_version: str = manifest["apiVersion"]
238238
kind: str = manifest["kind"]
239239
metadata: dict = manifest["metadata"]
@@ -245,7 +245,7 @@ def create_k8s_object(self, manifest: dict, timeout: int = 60 * 5) -> None:
245245
duration: int = self._k8s_create_times[key]
246246
time.sleep(duration / 1000)
247247

248-
def update_k8s_object(self, manifest: dict, timeout: int = 60 * 5) -> None:
248+
def update_k8s_object(self, manifest: dict, timeout: int = 60 * 5, verbose: bool = True) -> None:
249249
api_version: str = manifest["apiVersion"]
250250
kind: str = manifest["kind"]
251251
metadata: dict = manifest["metadata"]

tests/test_manifest.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@
1414
from util import UserError
1515

1616

17-
@pytest.mark.parametrize("work_dir", [None, "/unknown/file", "./tests/.cache/action1"])
17+
@pytest.mark.parametrize("work_dir", ["/unknown/file", "./tests/.cache/action1"])
1818
@pytest.mark.parametrize("name", [None, "", "action"])
1919
@pytest.mark.parametrize("description", [None, "", "desssscriippttion"])
2020
@pytest.mark.parametrize("image", [None, "", "immmaage"])
2121
@pytest.mark.parametrize("entrypoint", [None, "", "ennntrrrypopiint"])
2222
@pytest.mark.parametrize("args", [None, [], ["1"], ["1", "2"], ["1", "", ""]])
2323
def test_action(work_dir: str, name: str, description: str, image: str, entrypoint: str, args: Sequence[str]):
24-
action: Action = Action(work_dir=Path(work_dir) if work_dir is not None else None,
24+
action: Action = Action(work_dir=Path(work_dir),
2525
name=name,
2626
description=description,
2727
image=image,
28-
entrypoint=entrypoint, args=args)
29-
assert action.work_dir == (Path(work_dir) if work_dir is not None else None)
28+
entrypoint=entrypoint,
29+
args=args)
30+
assert action.work_dir == Path(work_dir).absolute()
3031
assert action.name == name
3132
assert action.description == description
3233
assert action.image == image
@@ -66,7 +67,7 @@ def test_plug(name: str,
6667
allowed_resource_names=allowed_resource_names,
6768
allowed_resource_types=allowed_resource_types)
6869
assert plug.name == name
69-
assert plug.path == Path(path)
70+
assert plug.path == Path(path).absolute()
7071
assert plug.readonly == readonly
7172
assert plug.resource_name_patterns == allowed_resource_names
7273
assert plug.resource_type_patterns == allowed_resource_types
@@ -143,7 +144,7 @@ def create_manifest():
143144
for plug_name, expected_plug in expected['plugs'].items():
144145
plug: Plug = manifest.plug(plug_name)
145146
if 'name' in expected_plug: assert plug.name == expected_plug['name']
146-
if 'path' in expected_plug: assert plug.path == Path(expected_plug['path'])
147+
if 'path' in expected_plug: assert plug.path == Path(expected_plug['path']).absolute()
147148
if 'readonly' in expected_plug: assert plug.readonly == expected_plug['readonly']
148149
if 'resource_name_patterns' in expected_plug:
149150
assert plug.resource_name_patterns == expected_plug['resource_name_patterns']
@@ -308,6 +309,6 @@ def test_resource_initialize(capsys):
308309
assert resource._state_action.args == init_result['state_action']['args']
309310
assert resource._status == ResourceStatus.INITIALIZED
310311
assert resource._plug_volumes == [
311-
f"{str(scenario_dir / 'p2')}:{init_result['plugs']['readonly_plug']['container_path']}:ro",
312-
f"{str(scenario_dir / 'p1')}:{init_result['plugs']['writable_plug']['container_path']}:rw"
312+
f"{str((scenario_dir / 'p2').absolute())}:{init_result['plugs']['readonly_plug']['container_path']}:ro",
313+
f"{str((scenario_dir / 'p1').absolute())}:{init_result['plugs']['writable_plug']['container_path']}:rw"
313314
]

0 commit comments

Comments
 (0)