Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TGIS test for fetching model from Minio object storage #1231

Merged
merged 13 commits into from
Feb 29, 2024
64 changes: 64 additions & 0 deletions ods_ci/tests/Resources/CLI/Minio.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
*** Settings ***
Documentation Collcetion of keywords to deploy and remove MinIO storage
Library OperatingSystem
Resource ../Common.robot


*** Variables ***
${MINIO_RESOURCES_DIRPATH}= ods_ci/tests/Resources/Files/minio
${MINIO_POD_FILEPATH}= ${MINIO_RESOURCES_DIRPATH}/minio.yaml
${MINIO_SECRET_FILEPATH}= ${MINIO_RESOURCES_DIRPATH}/minio_secret.yaml
${MINIO_SA_FILEPATH}= ${MINIO_RESOURCES_DIRPATH}/minio_serviceaccount.yaml


*** Keywords ***
Deploy MinIO

Check warning

Code scanning / Robocop

Keyword '{{ keyword_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Keyword 'Deploy MinIO' has too many keywords inside (16/10)
[Documentation] Deploys MiniIO pod, service and route using the given ${minio_image}
[Arguments] ${minio_image}=quay.io/modh/ods-ci-minio-models:1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use digest for the compatibility for disconnected cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bdattoma why do you deploy the Minio? In a disconencted env it is already available.
It is enough just to check test-variables.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will discuss offline

... ${namespace}=minio ${podname}=ods-ci-minio

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
... ${service_name}=ods-ci-minio-srv ${route_name}=ods-ci-minio-route

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
${exists}= Run Keyword And Return Status
... Check If Pod Exists namespace=${namespace} label_selector=app=minio status_only=${FALSE}
IF ${exists}
Log message=Minio pod with name ${podname} in ${namespace} NS already present. Re-using existing one.
ELSE
${key} ${pw}= Generate Minio Random Credentials
Set Test Variable ${key}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Set Test Variable ${pw}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Set Test Variable ${podname}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Set Test Variable ${minio_image}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Set Test Variable ${service_name}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Set Test Variable ${route_name}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Test Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Create File From Template ${MINIO_POD_FILEPATH} ${MINIO_RESOURCES_DIRPATH}/minio_filled.yaml
${rc}= Run And Return Rc oc new-project ${namespace}

Check warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning test

Local variable '${rc}' is overwritten before usage
${rc} ${out}= Run And Return Rc And Output
... oc apply -f ${MINIO_RESOURCES_DIRPATH}/minio_filled.yaml -n ${namespace}
Wait For Pods To Be Ready label_selector=app=minio
... namespace=${namespace}
END
${rc} ${route}= Run And Return Rc And Output
... oc get route ${route_name} -n ${namespace} --template={{.spec.host}}
Should Be Equal As Integers ${rc} ${0}
RETURN ${route}

Generate Minio Random Credentials
[Documentation] Generates a random pair of keywords to be used as default MinIO user credentials
${key}= Generate Random String chars=[NUMBERS][LETTERS]
${pw}= Generate Random String chars=[NUMBERS][LETTERS] length=12
RETURN ${key} ${pw}

Get Minio Credentials
[Documentation] Extracts the default MinIO user credentials from the pod env variables
[Arguments] ${namespace} ${podname}=ods-ci-minio
${rc} ${key}= Run And Return Rc And Output
... oc get pod ${podname} -n ${namespace} -o jsonpath='{range .spec.containers[*].env[?(@.name=="MINIO_ACCESS_KEY")]}{@.value}{end}' # robocop: disable
Should Be Equal As Integers ${rc} ${0}
${rc} ${pw}= Run And Return Rc And Output
... oc get pod ${podname} -n ${namespace} -o jsonpath='{range .spec.containers[*].env[?(@.name=="MINIO_SECRET_KEY")]}{@.value}{end}' # robocop: disable
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
Should Be Equal As Integers ${rc} ${0}
RETURN ${key} ${pw}

Remove Minio
[Documentation] Delete the MinIO objects from the cluster
Log message=To Be Implemented
# for the time being the test using Minio is deleting the NS.
tarukumar marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 11 additions & 1 deletion ods_ci/tests/Resources/CLI/ModelServing/llm.resource
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@
[Documentation] Creates the DS Project (if not exists), creates the data connection for the models,
... creates caikit runtime. This can be used as test setup
[Arguments] ${namespace} ${enable_metrics}=${FALSE} ${runtime}=caikit-tgis-runtime ${protocol}=grpc
... ${access_key_id}=${S3.AWS_ACCESS_KEY_ID} ${access_key}=${S3.AWS_SECRET_ACCESS_KEY}

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
... ${endpoint}=${MODELS_BUCKET.ENDPOINT} ${verify_ssl}=${TRUE}

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
Set Up Test OpenShift Project test_ns=${namespace}
Create Secret For S3-Like Buckets endpoint=${MODELS_BUCKET.ENDPOINT}
Create Secret For S3-Like Buckets endpoint=${endpoint}
... region=${MODELS_BUCKET.REGION} namespace=${namespace}
... access_key_id=${access_key_id} access_key=${access_key}
... verify_ssl=${verify_ssl}
Deploy Serving Runtime namespace=${namespace} runtime=${runtime} protocol=${protocol}
IF ${enable_metrics} == ${TRUE}
Enable User Workload Monitoring
Expand All @@ -72,6 +76,7 @@
... ${namespace}=${TEST_NS} ${endpoint}=${S3.AWS_DEFAULT_ENDPOINT}
... ${region}=${S3.AWS_DEFAULT_REGION} ${access_key_id}=${S3.AWS_ACCESS_KEY_ID}
... ${access_key}=${S3.AWS_SECRET_ACCESS_KEY} ${use_https}=${USE_BUCKET_HTTPS}
... ${verify_ssl}=${TRUE}
${rc} ${out}= Run And Return Rc And Output oc get secret ${name} -n ${namespace}
IF "${rc}" == "${0}"
Log message=Secret ${name} in ${namespace} NS already present. Skipping secret setup...
Expand Down Expand Up @@ -102,6 +107,11 @@
Should Be Equal As Integers ${rc} ${0}
Run Keyword And Ignore Error Run oc create -f ${LLM_RESOURCES_DIRPATH}/bucket_sa_filled.yaml -n ${namespace}
Add Secret To Service Account sa_name=${sa_name} secret_name=${name} namespace=${namespace}
IF ${verify_ssl} == ${FALSE}

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'IF' condition can be simplified
${rc} ${out}= Run And Return Rc And Output
... oc annotate secret ${name} -n ${namespace} serving.kserve.io/s3-verifyssl='false' --overwrite
Should Be Equal As Integers ${rc} ${0}
END
tarukumar marked this conversation as resolved.
Show resolved Hide resolved

Compile Inference Service YAML
[Documentation] Prepare the Inference Service YAML file in order to deploy a model
Expand Down
56 changes: 56 additions & 0 deletions ods_ci/tests/Resources/Files/minio/minio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Service
metadata:
name: ${service_name}
tarukumar marked this conversation as resolved.
Show resolved Hide resolved
spec:
ports:
- name: minio-client-port
port: 9000
protocol: TCP
targetPort: 9000
selector:
app: minio
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: ${route_name}
tarukumar marked this conversation as resolved.
Show resolved Hide resolved
spec:
to:
kind: Service
name: ${service_name}
weight: 100
port:
targetPort: minio-client-port
wildcardPolicy: None
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: minio
name: ${podname}
spec:

Check warning

Code scanning / SonarCloud

Service account tokens should not be mounted in pods

<!--SONAR_ISSUE_KEY:AY3mg2JV5j8f5LVwTkuG-->Set automountServiceAccountToken to false for this specification of kind Pod. <p>See more on <a href="https://sonarcloud.io/project/issues?id=red-hat-data-services_ods-ci&issues=AY3mg2JV5j8f5LVwTkuG&open=AY3mg2JV5j8f5LVwTkuG&pullRequest=1231">SonarCloud</a></p>
automountServiceAccountToken: false
containers:
- args:

Check warning

Code scanning / SonarCloud

CPU limits should be enforced

<!--SONAR_ISSUE_KEY:AY3mg2JV5j8f5LVwTkuE-->Specify a CPU limit for this container. <p>See more on <a href="https://sonarcloud.io/project/issues?id=red-hat-data-services_ods-ci&issues=AY3mg2JV5j8f5LVwTkuE&open=AY3mg2JV5j8f5LVwTkuE&pullRequest=1231">SonarCloud</a></p>

Check warning

Code scanning / SonarCloud

Memory limits should be enforced

<!--SONAR_ISSUE_KEY:AY3mg2JV5j8f5LVwTkuF-->Specify a memory limit for this container. <p>See more on <a href="https://sonarcloud.io/project/issues?id=red-hat-data-services_ods-ci&issues=AY3mg2JV5j8f5LVwTkuF&open=AY3mg2JV5j8f5LVwTkuF&pullRequest=1231">SonarCloud</a></p>
- server
- /data1
env:
- name: MINIO_ACCESS_KEY
value: ${key}
- name: MINIO_SECRET_KEY
value: ${pw}
image: ${minio_image}
imagePullPolicy: Always
name: minio
resources:
limits:
cpu: 250m
memory: 10Gi
requests:
cpu: 20m
memory: 400Mi
2 changes: 2 additions & 0 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Resource Common.robot
... Login To OCP Using API
... Generate Thanos Token
... Set Thanos Credentials Variables
... Generate Minio Random Credentials
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
... Get Minio Credentials


*** Keywords ***
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
*** Settings ***
Documentation Collection of CLI tests to validate fetching models from different object storages
... in the scope of model serving stack for Large Language Models (LLM).
... These tests leverage on TGIS Standalone Serving Runtime
Resource ../../../../Resources/OCP.resource
Resource ../../../../Resources/CLI/ModelServing/llm.resource
Resource ../../../../Resources/CLI/Minio.resource
Library OpenShiftLibrary
Suite Setup Suite Setup
Suite Teardown RHOSi Teardown
Test Tags KServe


*** Variables ***
${MODEL_S3_DIR}= flan-t5-small-hf
${TEST_NS}= tgis-storages
${TGIS_RUNTIME_NAME}= tgis-runtime


Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
*** Test Cases ***
Verify User Can Serve And Query A Model From Minio

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' is too long ({{ test_length }}/{{ allowed_length }}) Warning test

Test case 'Verify User Can Serve And Query A Model From Minio' is too long (32/20)

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Test case 'Verify User Can Serve And Query A Model From Minio' has too many keywords inside (13/10)
[Documentation] Basic tests for preparing, deploying and querying a LLM model
... using Kserve and TGIS runtime fetching models from a MinIO server
[Tags] Tier1 RHOAIENG-3490
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
${minio_namespace}= Set Variable minio-models
${minio_endpoint}= Deploy MinIO namespace=${minio_namespace}
${key} ${pw}= Get Minio Credentials namespace=${minio_namespace}
Set Project And Runtime runtime=${TGIS_RUNTIME_NAME} namespace=${TEST_NS}-minio
... access_key_id=${key} access_key=${pw}
... endpoint=${minio_endpoint}
... verify_ssl=${FALSE} # temporary
${test_namespace}= Set Variable ${TEST_NS}-minio
${model_name}= Set Variable flan-t5-small-hf
${models_names}= Create List ${model_name}

Check notice

Code scanning / Robocop

{{ create_keyword }} can be replaced with VAR Note test

Create List can be replaced with VAR
${storage_uri}= Set Variable s3://models/${MODEL_S3_DIR}/
Compile Inference Service YAML isvc_name=${model_name}
... sa_name=${DEFAULT_BUCKET_SA_NAME}
... model_storage_uri=${storage_uri}
... model_format=pytorch serving_runtime=${TGIS_RUNTIME_NAME}
Deploy Model Via CLI isvc_filepath=${INFERENCESERVICE_FILLED_FILEPATH}
... namespace=${test_namespace}
Wait For Pods To Be Ready label_selector=serving.kserve.io/inferenceservice=${model_name}
... namespace=${test_namespace}
Query Model Multiple Times model_name=${model_name} runtime=${TGIS_RUNTIME_NAME}
... inference_type=all-tokens n_times=1
... namespace=${test_namespace}
Query Model Multiple Times model_name=${model_name} runtime=${TGIS_RUNTIME_NAME}
... inference_type=streaming n_times=1
... namespace=${test_namespace} validate_response=${FALSE}
[Teardown] Run Keywords
... Clean Up Test Project test_ns=${test_namespace} isvc_names=${models_names} wait_prj_deletion=${FALSE}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (121/120)
... AND
... Run And Return Rc oc delete project ${minio_namespace}


*** Keywords ***
Suite Setup
[Documentation]

Check warning

Code scanning / Robocop

Documentation of {{ block_name }} is empty Warning test

Documentation of 'Suite Setup' Keyword is empty
Skip If Component Is Not Enabled kserve
RHOSi Setup
Load Expected Responses
Run git clone https://github.com/IBM/text-generation-inference/
Loading