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

Pass kwargs along in APIObjectSyncMixin.list() #554

Merged
merged 3 commits into from
Jan 22, 2025
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
4 changes: 2 additions & 2 deletions kr8s/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ def adopt(self, child):
return run_sync(self.async_adopt)(child) # type: ignore

@classmethod
def list(cls):
yield from run_sync(cls.async_list)()
def list(cls, **kwargs):
yield from run_sync(cls.async_list)(**kwargs)


## v1 objects
Expand Down
10 changes: 10 additions & 0 deletions kr8s/tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,16 @@ async def test_pod_list():
assert {p.name for p in pods1} == {p.name for p in pods2}


async def test_pod_list_sync():
pods1 = [pod for pod in kr8s.get("pods", namespace=kr8s.ALL)]
pods2 = [pod for pod in SyncPod.list(namespace=kr8s.ALL)]
assert pods1 and pods2
assert len(pods1) == len(pods2)
assert all(isinstance(p, SyncPod) for p in pods1)
assert all(isinstance(p, SyncPod) for p in pods2)
assert {p.name for p in pods1} == {p.name for p in pods2}


@pytest.mark.parametrize(
"ports",
[
Expand Down
Loading