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
42 changes: 42 additions & 0 deletions ods_ci/tests/Resources/CLI/Minio.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
*** Settings ***
Documentation Collcetion of keywords to deploy and remove MinIO storage
Library OperatingSystem
Resource ../Common.robot

Check warning

Code scanning / Robocop

Invalid number of empty lines between sections ({{ empty_lines }}/{{ allowed_empty_lines }}) Warning test

Invalid number of empty lines between sections (1/2)
*** 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

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Deploy MinIO' keyword
[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
# ${key} ${pw}= Generate Minio Random Credentials
${key}= Set Variable user
${pw}= Set Variable myfakepassword
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 ${url} ${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
Create File From Template ${MINIO_POD_FILEPATH} ${MINIO_RESOURCES_DIRPATH}/minio_filled.yaml
# Create File From Template ${MINIO_SECRET_FILEPATH} ${MINIO_RESOURCES_DIRPATH}/minio_secret_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}

Check warning

Code scanning / Robocop

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

Line is too long (128/120)

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${rc}' is assigned but not used

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${out}' is assigned but not used
# Oc Apply kind=Pod src=${MINIO_RESOURCES_DIRPATH}/minio_filled.yaml namespace=${namespace}
# Oc Apply kind=Secret src=${MINIO_RESOURCES_DIRPATH}/minio_secret_filled.yaml namespace=${namespace}
# Oc Apply kind=ServiceAccount src=${MINIO_SA_FILEPATH} namespace=${namespace}
${route}= Run And Return Rc And Output oc get route minio-route -n ${namespace} --template={{.spec.host}}
RETURN ${route}

Generate Minio Random Credentials

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Generate Minio Random Credentials' keyword
${key}= Generate Random String chars=[NUMBERS][LETTERS]
${pw}= Generate Random String chars=[NUMBERS][LETTERS]
RETURN ${key} ${pw}

Get Minio Credentials

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Get Minio Credentials' keyword
[Arguments] ${namespace} ${podname}=ods-ci-minio

Check warning

Code scanning / Robocop

Keyword argument '{{ name }}' is not used Warning test

Keyword argument '${namespace}' is not used

Check warning

Code scanning / Robocop

Keyword argument '{{ name }}' is not used Warning test

Keyword argument '${podname}' is not used
${key}= Set Variable user
${pw}= Set Variable myfakepassword
RETURN ${key} ${pw}

Check warning

Code scanning / Robocop

Missing trailing blank line at the end of file Warning test

Missing trailing blank line at the end of file
13 changes: 12 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)

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
... ${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,12 @@
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}
${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

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line

Compile Inference Service YAML
[Documentation] Prepare the Inference Service YAML file in order to deploy a model
Expand Down
48 changes: 48 additions & 0 deletions ods_ci/tests/Resources/Files/minio/minio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: v1
kind: Service
metadata:
name: minio-service
spec:
ports:
- name: minio-client-port
port: 9000
protocol: TCP
targetPort: 9000
selector:
app: minio
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: minio-route
spec:
to:
kind: Service
name: minio-service
weight: 100
port:
targetPort: ui
wildcardPolicy: None
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: minio
name: ods-ci-minio
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>
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: ${url}
imagePullPolicy: Always
name: minio
1 change: 1 addition & 0 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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


*** 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 the 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
@{SEARCH_METRICS}= tgi_ istio_

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '@{SEARCH_METRICS}' is assigned but not used


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 Caikit+TGIS runtime
[Tags] Tier1 RHOAIENG-3490
lugi0 marked this conversation as resolved.
Show resolved Hide resolved
${minio_namespace}= Set Variable minio-models
Deploy MinIO namespace=${minio_namespace}
Wait For Pods To Be Ready label_selector=app=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-service.${minio_namespace}.svc.cluster.local:9000
... 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

Variable '{{ name }}' is assigned but not used Note test

Variable '${models_names}' is assigned but not used

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] Clean Up Test Project test_ns=${test_namespace}
# ... isvc_names=${models_names} wait_prj_deletion=${FALSE}


*** 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/

Check warning

Code scanning / Robocop

Missing trailing blank line at the end of file Warning test

Missing trailing blank line at the end of file
Loading