diff --git a/clients/python/tests/test_client.py b/clients/python/tests/test_client.py index b6c6e90a..002126da 100644 --- a/clients/python/tests/test_client.py +++ b/clients/python/tests/test_client.py @@ -107,6 +107,53 @@ async def test_update_models(client: ModelRegistry): assert client.update(ma).description == new_description +@pytest.mark.e2e +async def test_update_logical_model_with_labels(client: ModelRegistry): + """As a MLOps engineer I would like to store some labels + + A custom property of type string, with empty string value, shall be considered a Label; this is also semantically compatible for properties having empty string values in general. + """ + name = "test_model" + version = "1.0.0" + rm = client.register_model( + name, + "s3", + model_format_name="test_format", + model_format_version="test_version", + version=version, + ) + assert rm.id + mv = client.get_model_version(name, version) + assert mv.id + ma = client.get_model_artifact(name, version) + assert ma.id + + rm_labels = { + "my-label1": "", + "my-label2": "", + } + rm.custom_properties = rm_labels + client.update(rm) + + mv_labels = { + "my-label3": "", + "my-label4": "", + } + mv.custom_properties = mv_labels + client.update(mv) + + ma_labels = { + "my-label5": "", + "my-label6": "", + } + ma.custom_properties = ma_labels + client.update(ma) + + assert client.get_registered_model(name).custom_properties == rm_labels + assert client.get_model_version(name, version).custom_properties == mv_labels + assert client.get_model_artifact(name, version).custom_properties == ma_labels + + @pytest.mark.e2e async def test_update_preserves_model_info(client: ModelRegistry): name = "test_model" diff --git a/test/robot/UserStory.robot b/test/robot/UserStory.robot index 1376c49b..c69b0696 100644 --- a/test/robot/UserStory.robot +++ b/test/robot/UserStory.robot @@ -70,6 +70,7 @@ As a MLOps engineer I would like to store a longer documentation for the model And Should Be Equal As Integers ${cnt} 2 As a MLOps engineer I would like to store some labels + # MIGRATED TO test_update_logical_model_with_labels in pytest # A custom property of type string, with empty string value, shall be considered a Label; this is also semantically compatible for properties having empty string values in general. ${cp1} Create Dictionary my-label1=${{ {"string_value": "", "metadataType": "MetadataStringValue"} }} my-label2=${{ {"string_value": "", "metadataType": "MetadataStringValue"} }} Set To Dictionary ${registered_model} description=Lorem ipsum dolor sit amet name=${name} customProperties=${cp1}