From ed52ec7008658991f6ea9bdfc83ed378e8a046f8 Mon Sep 17 00:00:00 2001 From: Radim Kubis Date: Tue, 5 Mar 2024 20:37:07 +0100 Subject: [PATCH 1/2] New(robot): Environment variable TEST_PORT for setting test port (#28) Signed-off-by: Radim Kubis --- test/robot/MRkeywords.resource | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/robot/MRkeywords.resource b/test/robot/MRkeywords.resource index 048fcac6..ae0eee9f 100644 --- a/test/robot/MRkeywords.resource +++ b/test/robot/MRkeywords.resource @@ -6,6 +6,7 @@ Library ModelRegistry.py *** Variables *** ${MR_HOST} %{TEST_MR_HOST=localhost} +${MR_PORT} %{TEST_MR_PORT=8080} ${MODE} %{TEST_MODE=REST} *** Keywords *** @@ -13,7 +14,7 @@ I create a RegisteredModel having [Arguments] ${name} IF $MODE == "REST" ${data} Create Dictionary name=${name} - ${resp} POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/registered_models json=${data} expected_status=201 + ${resp} POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/registered_models json=${data} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -27,7 +28,7 @@ I create a RegisteredModel having I create a RegisteredModel [Arguments] ${payload} IF $MODE == "REST" - ${resp} POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/registered_models json=&{payload} expected_status=201 + ${resp} POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/registered_models json=&{payload} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -41,7 +42,7 @@ I create a child ModelVersion having [Arguments] ${registeredModelID} ${name} IF $MODE == "REST" ${data}= Create Dictionary name=${name} registeredModelID=${registeredModelID} - ${resp}= POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions json=${data} expected_status=201 + ${resp}= POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions json=${data} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -56,7 +57,7 @@ I create a child ModelVersion [Arguments] ${registeredModelID} ${payload} IF $MODE == "REST" Set To Dictionary ${payload} registeredModelID=${registeredModelID} - ${resp}= POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions json=&{payload} expected_status=201 + ${resp}= POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions json=&{payload} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -71,7 +72,7 @@ I create a child ModelArtifact having IF $MODE == "REST" ${data}= Create Dictionary uri=${uri} artifactType=model-artifact Log to console ${data} - ${resp}= POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=${data} expected_status=201 + ${resp}= POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=${data} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -85,7 +86,7 @@ I create a child ModelArtifact having I create a child ModelArtifact [Arguments] ${modelversionId} ${payload} IF $MODE == "REST" - ${resp}= POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=&{payload} expected_status=201 + ${resp}= POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=&{payload} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -98,7 +99,7 @@ I create a child ModelArtifact I create a child Artifact [Arguments] ${modelversionId} ${payload} IF $MODE == "REST" - ${resp}= POST url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=&{payload} expected_status=201 + ${resp}= POST url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions/${modelversionId}/artifacts json=&{payload} expected_status=201 Log to console ${resp.json()} ${result} Set Variable ${resp.json()['id']} ELSE @@ -111,7 +112,7 @@ I create a child Artifact I get RegisteredModelByID [Arguments] ${id} IF $MODE == "REST" - ${resp}= GET url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/registered_models/${id} expected_status=200 + ${resp}= GET url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/registered_models/${id} expected_status=200 ${result} Set Variable ${resp.json()} Log to console ${resp.json()} ELSE @@ -124,7 +125,7 @@ I get RegisteredModelByID I get ModelVersionByID [Arguments] ${id} IF $MODE == "REST" - ${resp}= GET url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions/${id} expected_status=200 + ${resp}= GET url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions/${id} expected_status=200 ${result} Set Variable ${resp.json()} Log to console ${resp.json()} ELSE @@ -137,7 +138,7 @@ I get ModelVersionByID I get ModelArtifactByID [Arguments] ${id} IF $MODE == "REST" - ${resp}= GET url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_artifacts/${id} expected_status=200 + ${resp}= GET url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_artifacts/${id} expected_status=200 ${result} Set Variable ${resp.json()} Log to console ${resp.json()} ELSE @@ -150,7 +151,7 @@ I get ModelArtifactByID I get ArtifactsByModelVersionID [Arguments] ${id} IF $MODE == "REST" - ${resp}= GET url=http://${MR_HOST}:8080/api/model_registry/v1alpha2/model_versions/${id}/artifacts expected_status=200 + ${resp}= GET url=http://${MR_HOST}:${MR_PORT}/api/model_registry/v1alpha2/model_versions/${id}/artifacts expected_status=200 ${result} Set Variable ${resp.json()} Log to console ${resp.json()} ELSE From ece101a5cc9a81bdeae17c81c16d4cfb93f886d0 Mon Sep 17 00:00:00 2001 From: Matteo Mortari Date: Tue, 5 Mar 2024 20:43:06 +0100 Subject: [PATCH 2/2] fix: make sh script compatible with Mac OSX sed (#21) Signed-off-by: Matteo Mortari --- scripts/gen_openapi_server.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/gen_openapi_server.sh b/scripts/gen_openapi_server.sh index 6bac6684..94ce1493 100755 --- a/scripts/gen_openapi_server.sh +++ b/scripts/gen_openapi_server.sh @@ -11,8 +11,14 @@ openapi-generator-cli generate \ --ignore-file-override $ROOT_FOLDER/.openapi-generator-ignore --additional-properties=outputAsLibrary=true,enumClassPrefix=true,router=chi,sourceFolder=,onlyInterfaces=true,isGoSubmodule=true,enumClassPrefix=true,useOneOfDiscriminatorLookup=true \ --template-dir $ROOT_FOLDER/templates/go-server -sed -i 's/, orderByParam/, model.OrderByField(orderByParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go -sed -i 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go +if [[ $(uname) == "Darwin" ]]; then + # introduce -i parameter for Mac OSX sed compatibility + sed -i '' 's/, orderByParam/, model.OrderByField(orderByParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go + sed -i '' 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go +else + sed -i 's/, orderByParam/, model.OrderByField(orderByParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go + sed -i 's/, sortOrderParam/, model.SortOrder(sortOrderParam)/g' $ROOT_FOLDER/internal/server/openapi/api_model_registry_service.go +fi echo "Assembling type_assert Go file" ./scripts/gen_type_asserts.sh