@@ -40,21 +40,16 @@ import (
4040 "sigs.k8s.io/controller-runtime/pkg/client"
4141
4242 "github.com/opendatahub-io/odh-model-controller/internal/controller/constants"
43- "github.com/opendatahub-io/odh-model-controller/internal/controller/utils"
4443 . "github.com/opendatahub-io/odh-model-controller/test/matchers"
4544 testutils "github.com/opendatahub-io/odh-model-controller/test/utils"
4645)
4746
4847const (
4948 KserveOvmsInferenceServiceName = "example-onnx-mnist"
5049 UnsupportedMetricsInferenceServiceName = "sklearn-v2-iris"
51- NilRuntimeInferenceServiceName = "sklearn-v2-iris-no-runtime"
52- NilModelInferenceServiceName = "custom-runtime"
5350
5451 UnsupportedMetricsInferenceServicePath = "./testdata/deploy/kserve-unsupported-metrics-inference-service.yaml"
5552 UnsupprtedMetricsServingRuntimePath = "./testdata/deploy/kserve-unsupported-metrics-serving-runtime.yaml"
56- NilRuntimeInferenceServicePath = "./testdata/deploy/kserve-nil-runtime-inference-service.yaml"
57- NilModelInferenceServicePath = "./testdata/deploy/kserve-nil-model-inference-service.yaml"
5853)
5954
6055var _ = Describe ("InferenceService Controller" , func () {
@@ -94,38 +89,6 @@ var _ = Describe("InferenceService Controller", func() {
9489 return inferenceService
9590 }
9691
97- verifyConfigMap := func (isvcName string , namespace string , supported bool , metricsData string ) {
98- metricsConfigMap , err := testutils .WaitForConfigMap (k8sClient , namespace , isvcName + constants .KserveMetricsConfigMapNameSuffix , 30 , 1 * time .Second )
99- Expect (err ).NotTo (HaveOccurred ())
100- Expect (metricsConfigMap ).NotTo (BeNil ())
101- var expectedMetricsConfigMap * corev1.ConfigMap
102- if supported {
103- finaldata := utils .SubstituteVariablesInQueries (metricsData , namespace , isvcName )
104- expectedMetricsConfigMap = & corev1.ConfigMap {
105- ObjectMeta : metav1.ObjectMeta {
106- Name : isvcName + constants .KserveMetricsConfigMapNameSuffix ,
107- Namespace : namespace ,
108- },
109- Data : map [string ]string {
110- "supported" : "true" ,
111- "metrics" : finaldata ,
112- },
113- }
114- } else {
115- expectedMetricsConfigMap = & corev1.ConfigMap {
116- ObjectMeta : metav1.ObjectMeta {
117- Name : UnsupportedMetricsInferenceServiceName + constants .KserveMetricsConfigMapNameSuffix ,
118- Namespace : testNs ,
119- },
120- Data : map [string ]string {
121- "supported" : "false" ,
122- },
123- }
124- }
125- Expect (testutils .CompareConfigMap (metricsConfigMap , expectedMetricsConfigMap )).Should (BeTrue ())
126- Expect (expectedMetricsConfigMap .Data ).NotTo (HaveKeyWithValue ("metrics" , ContainSubstring ("${REQUEST_RATE_INTERVAL}" )))
127- }
128-
12992 BeforeEach (func () {
13093 testNs = testutils .Namespaces .Create (ctx , k8sClient ).Name
13194
@@ -136,34 +99,6 @@ var _ = Describe("InferenceService Controller", func() {
13699 }
137100 })
138101
139- When ("deploying a Kserve model" , func () {
140- It ("[raw] if the runtime is supported for metrics, it should create a configmap with prometheus queries" , func () {
141- _ = createServingRuntime (testNs , KserveServingRuntimePath1 )
142- _ = createInferenceService (testNs , KserveOvmsInferenceServiceName , KserveInferenceServicePath1 , true )
143-
144- verifyConfigMap (KserveOvmsInferenceServiceName , testNs , true , constants .OvmsMetricsData )
145- })
146-
147- It ("[raw] if the runtime is not supported for metrics, it should create a configmap with the unsupported config" , func () {
148- _ = createServingRuntime (testNs , UnsupprtedMetricsServingRuntimePath )
149- _ = createInferenceService (testNs , UnsupportedMetricsInferenceServiceName , UnsupportedMetricsInferenceServicePath , true )
150-
151- verifyConfigMap (UnsupportedMetricsInferenceServiceName , testNs , false , "" )
152- })
153-
154- It ("[raw] if the isvc does not have a runtime specified and there is no supported runtime, an unsupported metrics configmap should be created" , func () {
155- _ = createInferenceService (testNs , NilRuntimeInferenceServiceName , NilRuntimeInferenceServicePath , true )
156-
157- verifyConfigMap (NilRuntimeInferenceServiceName , testNs , false , "" )
158- })
159-
160- It ("[raw] if the isvc does not have the model field specified, an unsupported metrics configmap should be created" , func () {
161- _ = createInferenceService (testNs , NilModelInferenceServiceName , NilModelInferenceServicePath , true )
162-
163- verifyConfigMap (NilModelInferenceServiceName , testNs , false , "" )
164- })
165- })
166-
167102 When ("deleting the deployed models" , func () {
168103 timeout10s := time .Second * 10
169104 interval4s := time .Second * 4
0 commit comments