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

Do not set object.raw on delete #471

Merged
merged 2 commits into from
Aug 27, 2024
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 @@ -333,8 +333,8 @@ async def delete(self, propagation_policy: str | None = None) -> None:
url=f"{self.endpoint}/{self.name}",
namespace=self.namespace,
data=json.dumps(data),
) as resp:
self.raw = resp.json()
):
pass
except ServerError as e:
if e.response and e.response.status_code == 404:
raise NotFoundError(f"Object {self.name} does not exist") from e
Expand Down
9 changes: 9 additions & 0 deletions kr8s/tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,15 @@ async def test_secret_data(ns):
await secret.delete()


async def test_secret_create_delete_not_changed(ns):
[secret] = await objects_from_files(CURRENT_DIR / "resources" / "secret.yaml")
secret.namespace = ns
await secret.create()
await secret.delete()
exists = await secret.exists()
assert not exists


async def test_validate_pod(example_pod_spec):
kubernetes_validate = pytest.importorskip("kubernetes_validate")
pod = await Pod(example_pod_spec)
Expand Down
Loading