Skip to content

Commit d442f41

Browse files
authored
test: Add unit test for get_cloud_function_name (#2018)
1 parent c02a1b6 commit d442f41

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/unit/functions/test_remote_function_utils.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,42 @@ def test_get_remote_function_locations(
4040
assert cf_region == expected_cf_region
4141

4242

43+
@pytest.mark.parametrize(
44+
"func_hash, session_id, uniq_suffix, expected_name",
45+
[
46+
(
47+
"hash123",
48+
None,
49+
None,
50+
"bigframes-hash123",
51+
),
52+
(
53+
"hash456",
54+
"session789",
55+
None,
56+
"bigframes-session789-hash456",
57+
),
58+
(
59+
"hash123",
60+
None,
61+
"suffixABC",
62+
"bigframes-hash123-suffixABC",
63+
),
64+
(
65+
"hash456",
66+
"session789",
67+
"suffixDEF",
68+
"bigframes-session789-hash456-suffixDEF",
69+
),
70+
],
71+
)
72+
def test_get_cloud_function_name(func_hash, session_id, uniq_suffix, expected_name):
73+
"""Tests the construction of the cloud function name from its parts."""
74+
result = _utils.get_cloud_function_name(func_hash, session_id, uniq_suffix)
75+
76+
assert result == expected_name
77+
78+
4379
def test_get_updated_package_requirements_no_extra_package():
4480
"""Tests with no extra package."""
4581
result = _utils.get_updated_package_requirements(capture_references=False)

0 commit comments

Comments
 (0)