Skip to content

Commit 8b0050e

Browse files
MichaelZp0Michael Zappe
andauthored
Fixed error message check in remote rendering tests (#34962)
* Fixed error message check * Use correct field in exception * More output of tests * Case sensitive assert and add new recordings * Correct not None syntax --------- Co-authored-by: Michael Zappe <[email protected]>
1 parent acfb396 commit 8b0050e

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

sdk/remoterendering/azure-mixedreality-remoterendering/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/remoterendering/azure-mixedreality-remoterendering",
5-
"Tag": "python/remoterendering/azure-mixedreality-remoterendering_a55c315517"
5+
"Tag": "python/remoterendering/azure-mixedreality-remoterendering_f4be00cf1c"
66
}

sdk/remoterendering/azure-mixedreality-remoterendering/dev_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
../../mixedreality/azure-mixedreality-authentication
44
aiohttp>=3.0
55
-e ../../identity/azure-identity
6+
configargparse

sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# --------------------------------------------------------------------------
66
import pytest
77
import uuid
8+
import json
89

910
from azure.core.credentials import AzureKeyCredential
1011
from azure.core.exceptions import HttpResponseError
@@ -69,6 +70,8 @@ def test_simple_conversion(self, recorded_test, account_info, arr_client):
6970
conversion_id = account_info["id_placeholder"]
7071
if self.is_live:
7172
conversion_id += str(uuid.uuid4())
73+
74+
print("Using conversion id: {}".format(conversion_id))
7275

7376
storage_container_uri = "https://"+account_info["storage_account_name"] + \
7477
".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"]
@@ -120,6 +123,8 @@ def test_failed_conversion_unauthorized(self, recorded_test, account_info):
120123
conversion_id = account_info["id_placeholder"]
121124
if self.is_live:
122125
conversion_id += str(uuid.uuid4())
126+
127+
print("Using conversion id: {}".format(conversion_id))
123128

124129
storage_container_uri = "https://"+account_info["storage_account_name"] + \
125130
".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"]
@@ -182,6 +187,8 @@ def test_failed_conversion_missing_asset(self, recorded_test, account_info, arr_
182187
if self.is_live:
183188
conversion_id += str(uuid.uuid4())
184189

190+
print("Using conversion id: {}".format(conversion_id))
191+
185192
storage_container_uri = "https://"+account_info["storage_account_name"] + \
186193
".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"]
187194

@@ -204,13 +211,21 @@ def test_failed_conversion_missing_asset(self, recorded_test, account_info, arr_
204211
conversion_poller.result()
205212

206213
error_details = excinfo.value
207-
assert "invalid input" in error_details.error.message.lower()
208-
assert "logs" in error_details.error.message.lower()
214+
215+
print(json.dumps(error_details.error.__dict__))
216+
217+
assert "InputContainerError" == error_details.error.code
218+
# Message: "Could not find the asset file in the storage account. Please make sure all paths and names are correct and the file is uploaded to storage."
219+
assert error_details.error.message is not None
220+
assert "Could not find the asset file in the storage account" in error_details.error.message
209221

210222
def test_simple_session(self, recorded_test, account_info, arr_client):
211223
session_id = account_info["id_placeholder"]
212224
if self.is_live:
213225
session_id += str(uuid.uuid4())
226+
227+
print("Using session id: {}".format(session_id))
228+
214229
session_poller = arr_client.begin_rendering_session(
215230
session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=15)
216231

@@ -252,6 +267,8 @@ def test_failed_session_request(self, recorded_test, account_info, arr_client):
252267
session_id = account_info["id_placeholder"]
253268
if self.is_live:
254269
session_id += str(uuid.uuid4())
270+
271+
print("Using session id: {}".format(session_id))
255272

256273
with pytest.raises(HttpResponseError) as excinfo:
257274
# Make an invalid request (negative lease time).

sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client_async.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,10 @@ async def test_failed_conversion_missing_asset(self, recorded_test, account_info
210210
await conversion_poller.result()
211211

212212
error_details = excinfo.value
213-
assert "invalid input" in error_details.error.message.lower()
214-
assert "logs" in error_details.error.message.lower()
213+
assert "InputContainerError" == error_details.error.code
214+
# Message: "Could not find the asset file in the storage account. Please make sure all paths and names are correct and the file is uploaded to storage."
215+
assert error_details.error.message is not None
216+
assert "Could not find the asset file in the storage account" in error_details.error.message
215217

216218
@pytest.mark.asyncio
217219
async def test_simple_session(self, recorded_test, account_info, async_arr_client):

0 commit comments

Comments
 (0)