Skip to content

Commit 29f5448

Browse files
committed
add test
1 parent 1a9cba5 commit 29f5448

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/tests_app/components/test_auto_scaler.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from lightning_app import LightningWork
6+
from lightning_app import CloudCompute, LightningWork
77
from lightning_app.components import AutoScaler
88

99

@@ -90,3 +90,11 @@ def test_scale(replicas, metrics, expected_replicas):
9090
)
9191

9292
assert auto_scaler.scale(replicas, metrics) == expected_replicas
93+
94+
95+
def test_create_work_cloud_compute_cloned():
96+
"""Test CloudCompute is cloned to avoid creating multiple works in a single machine."""
97+
cloud_compute = CloudCompute("gpu")
98+
auto_scaler = AutoScaler(EmptyWork, cloud_compute=cloud_compute)
99+
_ = auto_scaler.create_work()
100+
assert auto_scaler._work_kwargs["cloud_compute"] is not cloud_compute

0 commit comments

Comments
 (0)