Skip to content

Commit

Permalink
Adding no rebuild test
Browse files Browse the repository at this point in the history
  • Loading branch information
TheQuantumFractal committed Jul 3, 2024
1 parent decebd9 commit 4c4d051
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ def f(self):

class FooInstance:
bar: str = "5"
barbar: str = "2"

@build()
def build_func(self):
Expand All @@ -774,6 +775,23 @@ def test_image_cls_var_rebuild(client, servicer):
assert image_id != image_id2


def test_image_cls_var_no_rebuild(client, servicer):
rebuild_app = App()
image_id = -1
rebuild_app.cls(image=Image.debian_slim())(FooInstance)
with rebuild_app.run(client=client):
image_id = list(servicer.images.keys())[-1]
rebuild_app.cls(image=Image.debian_slim())(FooInstance)
with rebuild_app.run(client=client):
image_id2 = list(servicer.images.keys())[-1]
FooInstance.barbar = "22"
rebuild_app.cls(image=Image.debian_slim())(FooInstance)
with rebuild_app.run(client=client):
image_id3 = list(servicer.images.keys())[-1]
assert image_id == image_id2
assert image_id2 == image_id3


def test_image_build_snapshot(client, servicer):
with cls_app.run(client=client):
image_id = list(servicer.images.keys())[-1]
Expand Down

0 comments on commit 4c4d051

Please sign in to comment.