Skip to content

Commit b5e1209

Browse files
committed
fix tests
1 parent 7af4564 commit b5e1209

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

api/test/api/test_launch_template_juicefs.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import pytest
22

3+
from transformerlab.services.compute_provider.launch_juicefs import (
4+
build_juicefs_install_command,
5+
build_juicefs_pod_config,
6+
)
7+
38

49
def test_build_juicefs_pod_config_env_vars(monkeypatch):
510
monkeypatch.setenv("TFL_JUICEFS_METADATA_URL", "redis://localhost:6379/1")
611
monkeypatch.setenv("TFL_JUICEFS_VOLUME_NAME", "myvol")
712

8-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
9-
10-
env_vars, mount_cmd, storage_uri = _build_juicefs_pod_config(
13+
env_vars, mount_cmd, storage_uri = build_juicefs_pod_config(
1114
team_id="team-abc",
1215
mount_point="/mnt/juicefs",
1316
)
@@ -24,9 +27,7 @@ def test_build_juicefs_pod_config_mount_command(monkeypatch):
2427
monkeypatch.delenv("TFL_JUICEFS_TOKEN", raising=False)
2528
monkeypatch.delenv("TFL_JUICEFS_CONSOLE_URL", raising=False)
2629

27-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
28-
29-
_, mount_cmd, _ = _build_juicefs_pod_config(
30+
_, mount_cmd, _ = build_juicefs_pod_config(
3031
team_id="team-abc",
3132
mount_point="/mnt/juicefs",
3233
)
@@ -38,9 +39,7 @@ def test_build_juicefs_pod_config_mount_command_includes_token(monkeypatch):
3839
monkeypatch.setenv("TFL_JUICEFS_VOLUME_NAME", "myvol")
3940
monkeypatch.setenv("TFL_JUICEFS_TOKEN", "hosted-token")
4041

41-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
42-
43-
env_vars, mount_cmd, _ = _build_juicefs_pod_config(
42+
env_vars, mount_cmd, _ = build_juicefs_pod_config(
4443
team_id="team-abc",
4544
mount_point="/mnt/juicefs",
4645
)
@@ -62,9 +61,7 @@ def test_build_juicefs_pod_config_mount_command_includes_console_url(monkeypatch
6261
monkeypatch.setenv("TFL_JUICEFS_TOKEN", "hosted-token")
6362
monkeypatch.setenv("TFL_JUICEFS_CONSOLE_URL", "http://juicefs-console:8080")
6463

65-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
66-
67-
env_vars, mount_cmd, _ = _build_juicefs_pod_config(
64+
env_vars, mount_cmd, _ = build_juicefs_pod_config(
6865
team_id="team-abc",
6966
mount_point="/mnt/juicefs",
7067
)
@@ -76,9 +73,7 @@ def test_build_juicefs_pod_config_mount_command_includes_console_url(monkeypatch
7673
def test_build_juicefs_pod_config_custom_mount_point(monkeypatch):
7774
monkeypatch.setenv("TFL_JUICEFS_VOLUME_NAME", "testvol")
7875

79-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
80-
81-
env_vars, mount_cmd, storage_uri = _build_juicefs_pod_config(
76+
env_vars, mount_cmd, storage_uri = build_juicefs_pod_config(
8277
team_id="team-xyz",
8378
mount_point="/custom/mount",
8479
)
@@ -91,16 +86,12 @@ def test_build_juicefs_pod_config_custom_mount_point(monkeypatch):
9186
def test_build_juicefs_pod_config_raises_on_empty_volume_name(monkeypatch):
9287
monkeypatch.delenv("TFL_JUICEFS_VOLUME_NAME", raising=False)
9388

94-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_pod_config
95-
9689
with pytest.raises(ValueError, match="TFL_JUICEFS_VOLUME_NAME"):
97-
_build_juicefs_pod_config(team_id="team-abc", mount_point="/mnt/juicefs")
90+
build_juicefs_pod_config(team_id="team-abc", mount_point="/mnt/juicefs")
9891

9992

10093
def test_build_juicefs_install_command_installs_when_missing():
101-
from transformerlab.services.compute_provider.launch_template import _build_juicefs_install_command
102-
103-
install_cmd = _build_juicefs_install_command()
94+
install_cmd = build_juicefs_install_command()
10495

10596
assert "command -v juicefs" in install_cmd
10697
assert "https://juicefs.com/static/juicefs" in install_cmd

0 commit comments

Comments
 (0)