diff --git a/.changes/unreleased/fixed-20260112-143553.yaml b/.changes/unreleased/fixed-20260112-143553.yaml new file mode 100644 index 00000000..cad27016 --- /dev/null +++ b/.changes/unreleased/fixed-20260112-143553.yaml @@ -0,0 +1,6 @@ +kind: fixed +body: Fix the job run command so that it exits with status code 1 on failure. +time: 2026-01-12T14:35:53.325666256Z +custom: + Author: aviatco + AuthorLink: https://github.com/aviatco diff --git a/src/fabric_cli/utils/fab_cmd_job_utils.py b/src/fabric_cli/utils/fab_cmd_job_utils.py index 2197328f..1e537cd3 100644 --- a/src/fabric_cli/utils/fab_cmd_job_utils.py +++ b/src/fabric_cli/utils/fab_cmd_job_utils.py @@ -102,16 +102,11 @@ def wait_for_job_completion( ) return elif status == "Failed": - fab_ui.print_output_error( - FabricCLIError( + fab_ui.print_entries_unix_style([content], content.keys(), header=True) + raise FabricCLIError( ErrorMessages.Common.job_instance_failed(job_ins_id), fab_constant.ERROR_JOB_FAILED, - ), - command=args.command, - output_format_type=args.output_format, - ) - fab_ui.print_entries_unix_style([content], content.keys(), header=True) - return + ) elif status in ["NotStarted", "InProgress"]: fab_ui.print_progress(f"Job instance status: {status}") diff --git a/tests/test_commands/data/sample_items/example_failed.Notebook/.platform b/tests/test_commands/data/sample_items/example_failed.Notebook/.platform new file mode 100644 index 00000000..0792549d --- /dev/null +++ b/tests/test_commands/data/sample_items/example_failed.Notebook/.platform @@ -0,0 +1,12 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/fabric/gitIntegration/platformProperties/2.0.0/schema.json", + "metadata": { + "type": "Notebook", + "displayName": "example_failed", + "description": "Created by fab - designed to fail for testing" + }, + "config": { + "version": "2.0", + "logicalId": "00000000-0000-0000-0000-000000000000" + } +} \ No newline at end of file diff --git a/tests/test_commands/data/sample_items/example_failed.Notebook/notebook-content.ipynb b/tests/test_commands/data/sample_items/example_failed.Notebook/notebook-content.ipynb new file mode 100644 index 00000000..26f8cc99 --- /dev/null +++ b/tests/test_commands/data/sample_items/example_failed.Notebook/notebook-content.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "microsoft": { + "language": "python", + "language_group": "synapse_pyspark" + } + }, + "outputs": [], + "source": [ + "# This notebook is designed to fail for testing purposes\n", + "import sys\n", + "from time import sleep\n", + "\n", + "print('Starting notebook execution...')\n", + "sleep(2)\n", + "\n", + "# Intentionally cause a failure\n", + "raise Exception('Intentional failure for testing job failure scenarios')\n", + "\n", + "# This code should never be reached\n", + "print('This should never execute')" + ] + } + ], + "metadata": { + "dependencies": {}, + "kernel_info": { + "name": "synapse_pyspark" + }, + "kernelspec": { + "display_name": "synapse_pyspark", + "name": "synapse_pyspark" + }, + "language_info": { + "name": "python" + }, + "microsoft": { + "language": "python", + "language_group": "synapse_pyspark", + "ms_spell_check": { + "ms_spell_check_language": "en" + } + }, + "nteract": { + "version": "nteract-front-end@1.0.0" + }, + "spark_compute": { + "compute_id": "/trident/default", + "session_options": { + "conf": { + "spark.synapse.nbs.session.timeout": "1200000" + } + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml b/tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml index d91bfaeb..c96e4cba 100644 --- a/tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml +++ b/tests/test_commands/recordings/test_commands/test_jobs/class_setup.yaml @@ -11,12 +11,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": "My workspace", "description": "", "type": "Personal"}]}' headers: Access-Control-Expose-Headers: @@ -26,15 +26,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '466' + - '2232' Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 14:56:16 GMT + - Mon, 19 Jan 2026 13:12:34 GMT Pragma: - no-cache RequestId: - - 44867d1e-b196-408d-a59d-853099d12386 + - 4e2c0cb4-ed18-4096-b87b-957a3cbc8192 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -42,7 +42,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -60,12 +60,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": "My workspace", "description": "", "type": "Personal"}]}' headers: Access-Control-Expose-Headers: @@ -75,15 +75,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '466' + - '2232' Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 14:56:17 GMT + - Mon, 19 Jan 2026 13:12:34 GMT Pragma: - no-cache RequestId: - - b950f45e-3ecd-4ffe-9bd0-8f2bcc83fab1 + - 62d5a5a6-f18d-4f82-afb1-1b25b2db2f37 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -91,7 +91,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -109,13 +109,13 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/capacities response: body: string: '{"value": [{"id": "00000000-0000-0000-0000-000000000004", "displayName": - "mocked_fabriccli_capacity_name", "sku": "F16", "region": "West Europe", "state": + "mocked_fabriccli_capacity_name", "sku": "F32", "region": "Central US", "state": "Active"}]}' headers: Access-Control-Expose-Headers: @@ -125,15 +125,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '456' + - '425' Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 14:56:23 GMT + - Mon, 19 Jan 2026 13:12:40 GMT Pragma: - no-cache RequestId: - - 88b1f9a5-c429-4332-a6e0-de57280898d2 + - a5664de8-11d6-4182-b695-4db555cb2919 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -141,7 +141,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -162,12 +162,12 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (None; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (None; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: POST uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"id": "ab04aa79-51eb-45b8-8fa6-c96d985f33e7", "displayName": "fabriccli_WorkspacePerTestclass_000001", + string: '{"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}' headers: Access-Control-Expose-Headers: @@ -181,13 +181,13 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 14:56:32 GMT + - Mon, 19 Jan 2026 13:12:46 GMT Location: - - https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7 + - https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437 Pragma: - no-cache RequestId: - - 31dc3411-4e07-40c6-9e1b-39aef1d3d5b8 + - 2e49777f-790b-4976-9f30-93fe6d4506a9 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -195,7 +195,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -213,13 +213,13 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET uri: https://api.fabric.microsoft.com/v1/workspaces response: body: - string: '{"value": [{"id": "94da8ea5-0bd6-4a9e-b717-5fdb482f4c71", "displayName": - "My workspace", "description": "", "type": "Personal"}, {"id": "ab04aa79-51eb-45b8-8fa6-c96d985f33e7", + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' headers: @@ -230,15 +230,15 @@ interactions: Content-Encoding: - gzip Content-Length: - - '498' + - '2266' Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 15:19:47 GMT + - Mon, 19 Jan 2026 13:14:01 GMT Pragma: - no-cache RequestId: - - ab18667e-4ac1-4f63-af69-69c038a4bea0 + - 6573ea3c-6d46-4903-8c4d-26b5a8d933ae Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -246,7 +246,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -264,9 +264,9 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: GET - uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7/items + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items response: body: string: '{"value": []}' @@ -282,11 +282,11 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Sun, 07 Sep 2025 15:19:47 GMT + - Mon, 19 Jan 2026 13:14:01 GMT Pragma: - no-cache RequestId: - - afd4579c-aa01-4f03-a8fe-a6c0cf1c64d8 + - a8d40339-290e-4252-993e-606957f6c9a7 Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -294,7 +294,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: @@ -314,9 +314,9 @@ interactions: Content-Type: - application/json User-Agent: - - ms-fabric-cli/1.1.0.rc2 (job run; Linux; x86_64; 5.15.167.4-microsoft-standard-WSL2) + - ms-fabric-cli/1.3.1 (job run; Linux; x86_64; 6.6.87.2-microsoft-standard-WSL2) method: DELETE - uri: https://api.fabric.microsoft.com/v1/workspaces/ab04aa79-51eb-45b8-8fa6-c96d985f33e7 + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437 response: body: string: '' @@ -332,11 +332,11 @@ interactions: Content-Type: - application/octet-stream Date: - - Sun, 07 Sep 2025 15:19:47 GMT + - Mon, 19 Jan 2026 13:14:02 GMT Pragma: - no-cache RequestId: - - 4fbb4a9c-fec8-4c41-bd0b-6df06126cb8b + - 4e1f295c-c70b-4ed2-9eb0-33a1e04f30cd Strict-Transport-Security: - max-age=31536000; includeSubDomains X-Content-Type-Options: @@ -344,7 +344,7 @@ interactions: X-Frame-Options: - deny home-cluster-uri: - - https://wabi-west-europe-redirect.analysis.windows.net/ + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ request-redirected: - 'true' status: diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml new file mode 100644 index 00000000..0188f272 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_exits_with_code_1_success.yaml @@ -0,0 +1,667 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2165' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:13 GMT + Pragma: + - no-cache + RequestId: + - 6e96a34f-04db-4e1c-8ac9-f1117f6c62f5 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:14 GMT + Pragma: + - no-cache + RequestId: + - 815b91f0-09b6-4809-b8e6-260f1867fda8 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:15 GMT + Pragma: + - no-cache + RequestId: + - f1822da7-3957-49e1-ba90-b85bf0d74797 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"type": "Notebook", "description": "Imported from fab", "folderId": null, + "displayName": "fabcli000001", "definition": {"format": "ipynb", "parts": [{"path": + ".platform", "payload": "ewogICAgIiRzY2hlbWEiOiAiaHR0cHM6Ly9kZXZlbG9wZXIubWljcm9zb2Z0LmNvbS9qc29uLXNjaGVtYXMvZmFicmljL2dpdEludGVncmF0aW9uL3BsYXRmb3JtUHJvcGVydGllcy8yLjAuMC9zY2hlbWEuanNvbiIsCiAgICAibWV0YWRhdGEiOiB7CiAgICAgICAgInR5cGUiOiAiTm90ZWJvb2siLAogICAgICAgICJkaXNwbGF5TmFtZSI6ICJleGFtcGxlX2ZhaWxlZCIsCiAgICAgICAgImRlc2NyaXB0aW9uIjogIkNyZWF0ZWQgYnkgZmFiIC0gZGVzaWduZWQgdG8gZmFpbCBmb3IgdGVzdGluZyIKICAgIH0sCiAgICAiY29uZmlnIjogewogICAgICAgICJ2ZXJzaW9uIjogIjIuMCIsCiAgICAgICAgImxvZ2ljYWxJZCI6ICIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiCiAgICB9Cn0=", + "payloadType": "InlineBase64"}, {"path": "notebook-content.ipynb", "payload": + "ewogICAgImNlbGxzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImNlbGxfdHlwZSI6ICJjb2RlIiwKICAgICAgICAgICAgImV4ZWN1dGlvbl9jb3VudCI6IG51bGwsCiAgICAgICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICAgICAgICJtaWNyb3NvZnQiOiB7CiAgICAgICAgICAgICAgICAgICAgImxhbmd1YWdlIjogInB5dGhvbiIsCiAgICAgICAgICAgICAgICAgICAgImxhbmd1YWdlX2dyb3VwIjogInN5bmFwc2VfcHlzcGFyayIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgIm91dHB1dHMiOiBbXSwKICAgICAgICAgICAgInNvdXJjZSI6IFsKICAgICAgICAgICAgICAgICIjIFRoaXMgbm90ZWJvb2sgaXMgZGVzaWduZWQgdG8gZmFpbCBmb3IgdGVzdGluZyBwdXJwb3Nlc1xuIiwKICAgICAgICAgICAgICAgICJpbXBvcnQgc3lzXG4iLAogICAgICAgICAgICAgICAgImZyb20gdGltZSBpbXBvcnQgc2xlZXBcbiIsCiAgICAgICAgICAgICAgICAiXG4iLAogICAgICAgICAgICAgICAgInByaW50KCdTdGFydGluZyBub3RlYm9vayBleGVjdXRpb24uLi4nKVxuIiwKICAgICAgICAgICAgICAgICJzbGVlcCgyKVxuIiwKICAgICAgICAgICAgICAgICJcbiIsCiAgICAgICAgICAgICAgICAiIyBJbnRlbnRpb25hbGx5IGNhdXNlIGEgZmFpbHVyZVxuIiwKICAgICAgICAgICAgICAgICJyYWlzZSBFeGNlcHRpb24oJ0ludGVudGlvbmFsIGZhaWx1cmUgZm9yIHRlc3Rpbmcgam9iIGZhaWx1cmUgc2NlbmFyaW9zJylcbiIsCiAgICAgICAgICAgICAgICAiXG4iLAogICAgICAgICAgICAgICAgIiMgVGhpcyBjb2RlIHNob3VsZCBuZXZlciBiZSByZWFjaGVkXG4iLAogICAgICAgICAgICAgICAgInByaW50KCdUaGlzIHNob3VsZCBuZXZlciBleGVjdXRlJykiCiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJkZXBlbmRlbmNpZXMiOiB7fSwKICAgICAgICAia2VybmVsX2luZm8iOiB7CiAgICAgICAgICAgICJuYW1lIjogInN5bmFwc2VfcHlzcGFyayIKICAgICAgICB9LAogICAgICAgICJrZXJuZWxzcGVjIjogewogICAgICAgICAgICAiZGlzcGxheV9uYW1lIjogInN5bmFwc2VfcHlzcGFyayIsCiAgICAgICAgICAgICJuYW1lIjogInN5bmFwc2VfcHlzcGFyayIKICAgICAgICB9LAogICAgICAgICJsYW5ndWFnZV9pbmZvIjogewogICAgICAgICAgICAibmFtZSI6ICJweXRob24iCiAgICAgICAgfSwKICAgICAgICAibWljcm9zb2Z0IjogewogICAgICAgICAgICAibGFuZ3VhZ2UiOiAicHl0aG9uIiwKICAgICAgICAgICAgImxhbmd1YWdlX2dyb3VwIjogInN5bmFwc2VfcHlzcGFyayIsCiAgICAgICAgICAgICJtc19zcGVsbF9jaGVjayI6IHsKICAgICAgICAgICAgICAgICJtc19zcGVsbF9jaGVja19sYW5ndWFnZSI6ICJlbiIKICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgIm50ZXJhY3QiOiB7CiAgICAgICAgICAgICJ2ZXJzaW9uIjogIm50ZXJhY3QtZnJvbnQtZW5kQDEuMC4wIgogICAgICAgIH0sCiAgICAgICAgInNwYXJrX2NvbXB1dGUiOiB7CiAgICAgICAgICAgICJjb21wdXRlX2lkIjogIi90cmlkZW50L2RlZmF1bHQiLAogICAgICAgICAgICAic2Vzc2lvbl9vcHRpb25zIjogewogICAgICAgICAgICAgICAgImNvbmYiOiB7CiAgICAgICAgICAgICAgICAgICAgInNwYXJrLnN5bmFwc2UubmJzLnNlc3Npb24udGltZW91dCI6ICIxMjAwMDAwIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSwKICAgICJuYmZvcm1hdCI6IDQsCiAgICAibmJmb3JtYXRfbWlub3IiOiA1Cn0=", + "payloadType": "InlineBase64"}]}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3274' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:16 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64 + Pragma: + - no-cache + RequestId: + - 2d6bb832-b645-4a86-8e33-a3d449bcf82a + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64 + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64 + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-18T12:01:16.04544", + "lastUpdatedTimeUtc": "2026-01-18T12:01:17.8115532", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '130' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:47 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64/result + Pragma: + - no-cache + RequestId: + - 14e34eaf-05e5-455e-98f0-e0549271e83f + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/bb3cd5eb-0cfa-4b37-b4a8-9fd29f728a64/result + response: + body: + string: '{"id": "b38a1be9-9560-46df-9633-0846e4e9a38d", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 18 Jan 2026 12:01:47 GMT + Pragma: + - no-cache + RequestId: + - db9903e4-21c2-4231-ae8e-33916207ace6 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2165' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:47 GMT + Pragma: + - no-cache + RequestId: + - 471e4f3b-6b8a-4599-9724-d6efcf29d959 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items + response: + body: + string: '{"value": [{"id": "b38a1be9-9560-46df-9633-0846e4e9a38d", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '179' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:01:48 GMT + Pragma: + - no-cache + RequestId: + - d174e659-1eab-4b10-8a05-0ab49d8223bf + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items/b38a1be9-9560-46df-9633-0846e4e9a38d/jobs/instances?jobType=RunNotebook + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Sun, 18 Jan 2026 12:01:49 GMT + Location: + - https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items/b38a1be9-9560-46df-9633-0846e4e9a38d/jobs/instances/7aa1cd3f-0e6a-47d1-be63-0bdf90dd3add + Pragma: + - no-cache + RequestId: + - d0ddb980-ea3e-4bf1-a3ce-bbac11095a38 + Retry-After: + - '60' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items/b38a1be9-9560-46df-9633-0846e4e9a38d/jobs/instances/7aa1cd3f-0e6a-47d1-be63-0bdf90dd3add + response: + body: + string: '{"id": "7aa1cd3f-0e6a-47d1-be63-0bdf90dd3add", "itemId": "b38a1be9-9560-46df-9633-0846e4e9a38d", + "jobType": "RunNotebook", "invokeType": "Manual", "status": "Failed", "failureReason": + {"requestId": "83bb6112-4d68-40b6-81dc-3e049643e042", "errorCode": "JobInstanceStatusFailed", + "message": "Job instance failed without detail error"}, "rootActivityId": + "d0ddb980-ea3e-4bf1-a3ce-bbac11095a38", "startTimeUtc": "2026-01-18T12:01:52.1078383", + "endTimeUtc": "2026-01-18T12:02:16.9160633"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '325' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:02:53 GMT + Pragma: + - no-cache + RequestId: + - 83bb6112-4d68-40b6-81dc-3e049643e042 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2165' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:02:59 GMT + Pragma: + - no-cache + RequestId: + - c68411d5-4ec0-4ae8-b8c8-2e402091fd69 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items + response: + body: + string: '{"value": [{"id": "b38a1be9-9560-46df-9633-0846e4e9a38d", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "e7dbc608-206d-4d52-a03a-d25bc1e4c0ba"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '179' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sun, 18 Jan 2026 12:03:00 GMT + Pragma: + - no-cache + RequestId: + - 3949cffa-92a2-48ba-a55e-c69391bfde7c + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/e7dbc608-206d-4d52-a03a-d25bc1e4c0ba/items/b38a1be9-9560-46df-9633-0846e4e9a38d + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Sun, 18 Jan 2026 12:03:01 GMT + Pragma: + - no-cache + RequestId: + - 4772a894-f0aa-40a3-8475-9f8389810e21 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml new file mode 100644 index 00000000..acb193f0 --- /dev/null +++ b/tests/test_commands/recordings/test_commands/test_jobs/test_job_run_failure_with_timeout_exits_with_code_1_success.yaml @@ -0,0 +1,668 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2266' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:12:47 GMT + Pragma: + - no-cache + RequestId: + - b76100af-137b-43d9-a0d9-56f9daf0bb96 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:12:48 GMT + Pragma: + - no-cache + RequestId: + - b883af5a-e56f-45e6-91c7-d938196cf9f5 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items + response: + body: + string: '{"value": []}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '32' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:12:48 GMT + Pragma: + - no-cache + RequestId: + - 3add74d3-a0b8-407f-a559-76e649485c6d + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: '{"type": "Notebook", "description": "Imported from fab", "folderId": null, + "displayName": "fabcli000001", "definition": {"format": "ipynb", "parts": [{"path": + ".platform", "payload": "ewogICAgIiRzY2hlbWEiOiAiaHR0cHM6Ly9kZXZlbG9wZXIubWljcm9zb2Z0LmNvbS9qc29uLXNjaGVtYXMvZmFicmljL2dpdEludGVncmF0aW9uL3BsYXRmb3JtUHJvcGVydGllcy8yLjAuMC9zY2hlbWEuanNvbiIsCiAgICAibWV0YWRhdGEiOiB7CiAgICAgICAgInR5cGUiOiAiTm90ZWJvb2siLAogICAgICAgICJkaXNwbGF5TmFtZSI6ICJleGFtcGxlIiwKICAgICAgICAiZGVzY3JpcHRpb24iOiAiQ3JlYXRlZCBieSBmYWIiCiAgICB9LAogICAgImNvbmZpZyI6IHsKICAgICAgICAidmVyc2lvbiI6ICIyLjAiLAogICAgICAgICJsb2dpY2FsSWQiOiAiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIgogICAgfQp9", + "payloadType": "InlineBase64"}, {"path": "notebook-content.ipynb", "payload": + "ewogICAgImNlbGxzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImNlbGxfdHlwZSI6ICJjb2RlIiwKICAgICAgICAgICAgImV4ZWN1dGlvbl9jb3VudCI6IG51bGwsCiAgICAgICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICAgICAgICJtaWNyb3NvZnQiOiB7CiAgICAgICAgICAgICAgICAgICAgImxhbmd1YWdlIjogInB5dGhvbiIsCiAgICAgICAgICAgICAgICAgICAgImxhbmd1YWdlX2dyb3VwIjogInN5bmFwc2VfcHlzcGFyayIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgIm91dHB1dHMiOiBbXSwKICAgICAgICAgICAgInNvdXJjZSI6IFsKICAgICAgICAgICAgICAgICIjIFdlbGNvbWUgdG8geW91ciBuZXcgbm90ZWJvb2tcbiIsCiAgICAgICAgICAgICAgICAiIyBUeXBlIGhlcmUgaW4gdGhlIGNlbGwgZWRpdG9yIHRvIGFkZCBjb2RlIVxuIiwKICAgICAgICAgICAgICAgICJmcm9tIHRpbWUgaW1wb3J0IHNsZWVwXG4iLAogICAgICAgICAgICAgICAgInNsZWVwKDEyMCkiCiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJkZXBlbmRlbmNpZXMiOiB7fSwKICAgICAgICAia2VybmVsX2luZm8iOiB7CiAgICAgICAgICAgICJuYW1lIjogInN5bmFwc2VfcHlzcGFyayIKICAgICAgICB9LAogICAgICAgICJsYW5ndWFnZV9pbmZvIjogewogICAgICAgICAgICAibmFtZSI6ICJweXRob24iCiAgICAgICAgfSwKICAgICAgICAibWljcm9zb2Z0IjogewogICAgICAgICAgICAibGFuZ3VhZ2UiOiAicHl0aG9uIiwKICAgICAgICAgICAgImxhbmd1YWdlX2dyb3VwIjogInN5bmFwc2VfcHlzcGFyayIsCiAgICAgICAgICAgICJtc19zcGVsbF9jaGVjayI6IHsKICAgICAgICAgICAgICAgICJtc19zcGVsbF9jaGVja19sYW5ndWFnZSI6ICJlbiIKICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgIm50ZXJhY3QiOiB7CiAgICAgICAgICAgICJ2ZXJzaW9uIjogIm50ZXJhY3QtZnJvbnQtZW5kQDEuMC4wIgogICAgICAgIH0sCiAgICAgICAgInNwYXJrX2NvbXB1dGUiOiB7CiAgICAgICAgICAgICJjb21wdXRlX2lkIjogIi90cmlkZW50L2RlZmF1bHQiLAogICAgICAgICAgICAic2Vzc2lvbl9vcHRpb25zIjogewogICAgICAgICAgICAgICAgImNvbmYiOiB7CiAgICAgICAgICAgICAgICAgICAgInNwYXJrLnN5bmFwc2UubmJzLnNlc3Npb24udGltZW91dCI6ICIxMjAwMDAwIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSwKICAgICJuYmZvcm1hdCI6IDQsCiAgICAibmJmb3JtYXRfbWlub3IiOiA1Cn0K", + "payloadType": "InlineBase64"}]}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '2558' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items + response: + body: + string: 'null' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After,ETag,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '24' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:12:49 GMT + ETag: + - '""' + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd + Pragma: + - no-cache + RequestId: + - 7ea58a22-9ba2-4e24-a9f1-74e0da063a97 + Retry-After: + - '20' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + x-ms-operation-id: + - 6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd + response: + body: + string: '{"status": "Succeeded", "createdTimeUtc": "2026-01-19T13:12:49.5464615", + "lastUpdatedTimeUtc": "2026-01-19T13:12:51.2185914", "percentComplete": 100, + "error": null}' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,x-ms-operation-id + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '131' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:13:10 GMT + Location: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd/result + Pragma: + - no-cache + RequestId: + - 8f82b75d-3e63-465e-918d-36132e95517b + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + x-ms-operation-id: + - 6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://wabi-us-central-b-primary-redirect.analysis.windows.net/v1/operations/6eaf2f6f-0830-42ba-96b5-b47aa8ba62dd/result + response: + body: + string: '{"id": "b00f9fbc-1f06-48d1-85ce-10945ab9f567", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "4aec0924-bc5a-4b1a-a84b-e7863321d437"}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 19 Jan 2026 13:13:11 GMT + Pragma: + - no-cache + RequestId: + - 64a0802d-161c-4951-a1c8-790204cea868 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2266' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:13:12 GMT + Pragma: + - no-cache + RequestId: + - 81062297-07c3-453b-b6e6-2ef23c9933e2 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items + response: + body: + string: '{"value": [{"id": "b00f9fbc-1f06-48d1-85ce-10945ab9f567", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "4aec0924-bc5a-4b1a-a84b-e7863321d437"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '179' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:13:12 GMT + Pragma: + - no-cache + RequestId: + - 7cc4a1d2-9067-4d9f-ad15-3afbf721d9c9 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items/b00f9fbc-1f06-48d1-85ce-10945ab9f567/jobs/instances?jobType=RunNotebook + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Mon, 19 Jan 2026 13:13:12 GMT + Location: + - https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items/b00f9fbc-1f06-48d1-85ce-10945ab9f567/jobs/instances/ec7c1949-ca58-46a4-b009-80764486e211 + Pragma: + - no-cache + RequestId: + - 034e053b-9fb2-4808-a0e3-c9c3bc5b31bb + Retry-After: + - '60' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: POST + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items/b00f9fbc-1f06-48d1-85ce-10945ab9f567/jobs/instances/ec7c1949-ca58-46a4-b009-80764486e211/cancel + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId,Location,Retry-After + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Mon, 19 Jan 2026 13:13:56 GMT + Location: + - https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items/b00f9fbc-1f06-48d1-85ce-10945ab9f567/jobs/instances/ec7c1949-ca58-46a4-b009-80764486e211 + Pragma: + - no-cache + RequestId: + - 14accdd0-2965-4538-8dda-ffce676dc4cf + Retry-After: + - '60' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces + response: + body: + string: '{"value": [{"id": "3634a139-2c9e-4205-910b-3b089a31be47", "displayName": + "My workspace", "description": "", "type": "Personal"}, {"id": "4aec0924-bc5a-4b1a-a84b-e7863321d437", + "displayName": "fabriccli_WorkspacePerTestclass_000001", "description": "Created + by fab", "type": "Workspace", "capacityId": "00000000-0000-0000-0000-000000000004"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '2266' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:14:00 GMT + Pragma: + - no-cache + RequestId: + - 4ad79422-83f2-47c8-815a-d87cf737338b + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: GET + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items + response: + body: + string: '{"value": [{"id": "b00f9fbc-1f06-48d1-85ce-10945ab9f567", "type": "Notebook", + "displayName": "fabcli000001", "description": "Imported from fab", "workspaceId": + "4aec0924-bc5a-4b1a-a84b-e7863321d437"}]}' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '179' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 19 Jan 2026 13:13:59 GMT + Pragma: + - no-cache + RequestId: + - 67836340-15cc-4f43-bee1-4a5c443466f5 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - ms-fabric-cli-test/1.3.1 + method: DELETE + uri: https://api.fabric.microsoft.com/v1/workspaces/4aec0924-bc5a-4b1a-a84b-e7863321d437/items/b00f9fbc-1f06-48d1-85ce-10945ab9f567 + response: + body: + string: '' + headers: + Access-Control-Expose-Headers: + - RequestId + Cache-Control: + - no-store, must-revalidate, no-cache + Content-Encoding: + - gzip + Content-Length: + - '0' + Content-Type: + - application/octet-stream + Date: + - Mon, 19 Jan 2026 13:14:00 GMT + Pragma: + - no-cache + RequestId: + - f99a8afe-fc20-432e-929e-01d3a21017ca + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + home-cluster-uri: + - https://wabi-us-central-b-primary-redirect.analysis.windows.net/ + request-redirected: + - 'true' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_commands/test_jobs.py b/tests/test_commands/test_jobs.py index b339fdb1..8a05cea3 100644 --- a/tests/test_commands/test_jobs.py +++ b/tests/test_commands/test_jobs.py @@ -23,6 +23,7 @@ import fabric_cli.utils.fab_cmd_job_utils as utils_job from fabric_cli.core import fab_constant as constant from fabric_cli.core import fab_handle_context as handle_context +from fabric_cli.core.fab_exceptions import FabricCLIError from fabric_cli.core.fab_types import ItemType, VirtualItemContainerType from fabric_cli.core.hiearchy.fab_item import Item from fabric_cli.utils import fab_storage as utils_storage @@ -957,6 +958,42 @@ def test_run_schedule_rm_without_force_cancel_operation_success(self, cli_execut job_run_list(fabric_item.full_path, schedule=True) assert len(mock_questionary_print.call_args_list) != 0 + def test_job_run_exits_with_code_1_success(self, item_factory, cli_executor, assert_fabric_cli_error): + """Integration test to verify that job run command exits with code 1 when job fails.""" + # Setup - use the example_failed notebook which contains failing code + nb_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "data/sample_items/example_failed.Notebook", + ) + notebook = item_factory(ItemType.NOTEBOOK, content_path=nb_path) + + # Execute command - this should fail with ERROR_JOB_FAILED due to the exception in the notebook + cli_executor.exec_command(f"job run {notebook.full_path}") + + # Assert that the correct FabricCLIError was raised with exit code 1 + assert_fabric_cli_error( + constant.ERROR_JOB_FAILED, + "Failed" + ) + + def test_job_run_failure_with_timeout_exits_with_code_1_success(self, item_factory, cli_executor, mock_print_warning): + """Integration test to verify that timeout prints cancellation message and doesn't raise error.""" + # Setup - use a notebook that will run longer than the timeout + nb_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "data/sample_items/example_wait.Notebook", + ) + notebook = item_factory(ItemType.NOTEBOOK, content_path=nb_path) + + # Execute command with short timeout - this should timeout and print cancellation message + cli_executor.exec_command(f"job run {notebook.full_path} --timeout 1") + + # Verify that timeout warning was printed (not an error) + mock_print_warning.assert_called() + warning_message = mock_print_warning.call_args[0][0] + assert "timed out" in warning_message + + # region Helper Methods def job_run(path, params=None, config=None, input=None, timeout=None): job_exec(path, params, config, input, wait=True, timeout=timeout) diff --git a/tests/test_utils/test_fab_cmd_job_utils.py b/tests/test_utils/test_fab_cmd_job_utils.py index 46e2293d..1e04bbb8 100644 --- a/tests/test_utils/test_fab_cmd_job_utils.py +++ b/tests/test_utils/test_fab_cmd_job_utils.py @@ -100,8 +100,13 @@ def test_wait_for_job_completion_failed_status(mock_sleep, mock_api, mock_get_po mock_get_polling_interval.return_value = DEFAULT_POLLING_INTERVAL mock_api.return_value = create_mock_response(status="Failed", error="Test error") - wait_for_job_completion(default_job_args, "test-job-id", mock_job_response, custom_polling_interval=None) + # Should raise FabricCLIError with ERROR_JOB_FAILED when job status is "Failed" + with pytest.raises(FabricCLIError) as exc_info: + wait_for_job_completion(default_job_args, "test-job-id", mock_job_response, custom_polling_interval=None) + # Verify the exception details + assert exc_info.value.status_code == fab_constant.ERROR_JOB_FAILED + assert "Job instance 'test-job-id' Failed" in str(exc_info.value.message) assert mock_sleep.call_count == 1