Skip to content

Commit 08a9c45

Browse files
author
Mohamed Zeidan
committed
Fix failing unit tests to match enhanced error messages
- Update test expectations to match the new enhanced namespace error messages that include helpful list command suggestions - The enhanced error handling now provides more informative messages like: 'Use hyp list hyp-jumpstart-endpoint to check for available resources' - This addresses the GitHub CI test failures while maintaining the improved user experience
1 parent 1882dd0 commit 08a9c45

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/unit_tests/error_handling/test_cli_decorators.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ def test_generate_namespace_error_message(self):
148148
mock_get_context.return_value = mock_context
149149
message = _generate_namespace_error_message("test-ns", mock_func)
150150

151-
# Test should match actual working behavior - basic namespace error without list command
151+
# Test should match actual enhanced behavior - includes helpful list command suggestion
152152
assert "Namespace 'test-ns' does not exist on this cluster" in message
153-
assert message == "❌ Namespace 'test-ns' does not exist on this cluster."
153+
assert "Use 'hyp list hyp-jumpstart-endpoint' to check for available resources" in message
154+
expected_message = "❌ Namespace 'test-ns' does not exist on this cluster. Use 'hyp list hyp-jumpstart-endpoint' to check for available resources."
155+
assert message == expected_message
154156

155157
@patch('sagemaker.hyperpod.common.cli_decorators.click.get_current_context')
156158
@patch('sagemaker.hyperpod.common.cli_decorators._namespace_exists')
@@ -184,9 +186,11 @@ def list_pods_function(namespace="missing-ns"):
184186
# Should show namespace error message before function execution
185187
mock_click_echo.assert_called_once()
186188
first_call_args = mock_click_echo.call_args[0][0]
187-
# Test should match actual working behavior - basic namespace error
189+
# Test should match actual enhanced behavior - includes helpful list command suggestion
188190
assert "Namespace 'missing-ns' does not exist on this cluster" in first_call_args
189-
assert first_call_args == "❌ Namespace 'missing-ns' does not exist on this cluster."
191+
assert "Use 'hyp list hyp-jumpstart-endpoint' to check for available resources" in first_call_args
192+
expected_message = "❌ Namespace 'missing-ns' does not exist on this cluster. Use 'hyp list hyp-jumpstart-endpoint' to check for available resources."
193+
assert first_call_args == expected_message
190194
mock_sys_exit.assert_called_with(1)
191195

192196
# Verify function never executed (result should be None due to early return)

0 commit comments

Comments
 (0)