11import pytest
22from typing import Self , Any
3-
3+ import random
44from ocp_resources .config_map import ConfigMap
55from tests .model_registry .model_catalog .utils import (
66 fetch_all_artifacts_with_dynamic_paging ,
1515
1616LOGGER = get_logger (name = __name__ )
1717pytestmark = [pytest .mark .usefixtures ("updated_dsc_component_state_scope_session" , "model_registry_namespace" )]
18- MODEL_NAME_ARTIFACT_SEARCH = "RedHatAI/Llama-3.1-8B-Instruct"
18+ MODEL_NAMEs_ARTIFACT_SEARCH : list [str ] = [
19+ "RedHatAI/Llama-3.1-8B-Instruct" ,
20+ "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-FP8-dynamic" ,
21+ "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w4a16" ,
22+ "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8" ,
23+ "RedHatAI/Mixtral-8x7B-Instruct-v0.1" ,
24+ ]
1925
2026
2127class TestSearchArtifactsByFilterQuery :
@@ -76,7 +82,7 @@ def test_search_artifacts_by_invalid_filter_query(
7682 {
7783 "catalog_id" : VALIDATED_CATALOG_ID ,
7884 "header_type" : "registry" ,
79- "model_name" : MODEL_NAME_ARTIFACT_SEARCH ,
85+ "model_name" : random . choice ( MODEL_NAMEs_ARTIFACT_SEARCH ) ,
8086 },
8187 "hardware_type.string_value = 'ABC-1234'" ,
8288 None ,
@@ -87,7 +93,7 @@ def test_search_artifacts_by_invalid_filter_query(
8793 {
8894 "catalog_id" : VALIDATED_CATALOG_ID ,
8995 "header_type" : "registry" ,
90- "model_name" : MODEL_NAME_ARTIFACT_SEARCH ,
96+ "model_name" : random . choice ( MODEL_NAMEs_ARTIFACT_SEARCH ) ,
9197 },
9298 "requests_per_second.double_value > 15.0" ,
9399 [{"key_name" : "requests_per_second" , "key_type" : "double_value" , "comparison" : "min" , "value" : 15.0 }],
@@ -98,7 +104,7 @@ def test_search_artifacts_by_invalid_filter_query(
98104 {
99105 "catalog_id" : VALIDATED_CATALOG_ID ,
100106 "header_type" : "registry" ,
101- "model_name" : MODEL_NAME_ARTIFACT_SEARCH ,
107+ "model_name" : random . choice ( MODEL_NAMEs_ARTIFACT_SEARCH ) ,
102108 },
103109 "hardware_count.int_value = 8" ,
104110 [{"key_name" : "hardware_count" , "key_type" : "int_value" , "comparison" : "exact" , "value" : 8 }],
@@ -109,7 +115,7 @@ def test_search_artifacts_by_invalid_filter_query(
109115 {
110116 "catalog_id" : VALIDATED_CATALOG_ID ,
111117 "header_type" : "registry" ,
112- "model_name" : MODEL_NAME_ARTIFACT_SEARCH ,
118+ "model_name" : random . choice ( MODEL_NAMEs_ARTIFACT_SEARCH ) ,
113119 },
114120 "(hardware_type.string_value = 'H100') AND (ttft_p99.double_value < 200)" ,
115121 [
@@ -123,7 +129,7 @@ def test_search_artifacts_by_invalid_filter_query(
123129 {
124130 "catalog_id" : VALIDATED_CATALOG_ID ,
125131 "header_type" : "registry" ,
126- "model_name" : MODEL_NAME_ARTIFACT_SEARCH ,
132+ "model_name" : random . choice ( MODEL_NAMEs_ARTIFACT_SEARCH ) ,
127133 },
128134 "(tps_mean.double_value <260) OR (hardware_type.string_value = 'A100-80')" ,
129135 [
@@ -169,7 +175,7 @@ def test_filter_query_advanced_artifact_search(
169175
170176 if expected_value is None :
171177 # Simple validation of length and size for basic filter queries
172- assert len ( result ["items" ]) == [], f"Filter query '{ filter_query } ' should return valid results"
178+ assert result ["items" ] == [], f"Filter query '{ filter_query } ' should return valid results"
173179 assert result ["size" ] == 0 , f"Size should be 0 for filter query '{ filter_query } '"
174180 LOGGER .info (
175181 f"Successfully validated that filter query '{ filter_query } ' returns { len (result ['items' ])} artifacts"
0 commit comments