diff --git a/test/image_test.py b/test/image_test.py index fe2d02a09..2e9803980 100644 --- a/test/image_test.py +++ b/test/image_test.py @@ -752,6 +752,7 @@ def f(self): class FooInstance: bar: str = "5" + barbar: str = "2" @build() def build_func(self): @@ -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]