@@ -134,12 +134,7 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
134
134
* confflags .ImplementationContact ,
135
135
)
136
136
137
- // Inference Extension Specific Report Fields
138
- inferenceExtensionVersion := "v0.3.0"
139
- _ = inferenceExtensionVersion // Avoid unused variable error until implemented
140
-
141
137
baseManifestsValue := "resources/base.yaml"
142
-
143
138
opts := confsuite.ConformanceOptions {
144
139
Client : c ,
145
140
ClientOptions : clientOptions ,
@@ -166,7 +161,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
166
161
// TODO: Add the inference extension specific fields to ConformanceOptions struct if needed,
167
162
// or handle them during report generation.
168
163
// GatewayAPIInferenceExtensionChannel: inferenceExtensionChannel,
169
- // GatewayAPIInferenceExtensionVersion: inferenceExtensionVersion,
170
164
}
171
165
172
166
// Populate SupportedFeatures based on the GatewayLayerProfile.
@@ -209,19 +203,28 @@ func RunConformanceWithOptions(t *testing.T, opts confsuite.ConformanceOptions)
209
203
cSuite , err := confsuite .NewConformanceTestSuite (opts )
210
204
require .NoError (t , err , "error initializing conformance suite" )
211
205
206
+ installedCRDs := & apiextensionsv1.CustomResourceDefinitionList {}
207
+ err = opts .Client .List (context .TODO (), installedCRDs )
208
+ require .NoError (t , err , "error getting installedCRDs" )
209
+ apiVersion , err := getGatewayInferenceExtentionVersion (installedCRDs .Items )
210
+ if err != nil {
211
+ if opts .AllowCRDsMismatch {
212
+ apiVersion = "UNDEFINED"
213
+ } else {
214
+ require .NoError (t , err , "error getting the gateway ineference extension version" )
215
+ }
216
+ }
212
217
SetupConformanceTestSuite (t , cSuite , opts , tests .ConformanceTests )
213
-
214
218
t .Log ("Running Inference Extension conformance tests against all registered tests" )
215
219
err = cSuite .Run (t , tests .ConformanceTests )
216
220
require .NoError (t , err , "error running conformance tests" )
217
221
218
- // Generate and write the report if requested.
219
222
if opts .ReportOutputPath != "" {
220
223
t .Log ("Generating Inference Extension conformance report" )
221
224
report , err := cSuite .Report () // Use the existing report generation logic.
222
225
require .NoError (t , err , "error generating conformance report" )
223
226
inferenceReport := GatewayAPIInferenceExtensionConformanceReport {
224
- GatewayAPIInferenceExtensionVersion : version . BundleVersion ,
227
+ GatewayAPIInferenceExtensionVersion : apiVersion ,
225
228
ConformanceReport : * report ,
226
229
}
227
230
err = inferenceReport .WriteReport (t .Logf , opts .ReportOutputPath )
@@ -261,6 +264,24 @@ func SetupConformanceTestSuite(t *testing.T, suite *confsuite.ConformanceTestSui
261
264
ensureGatewayAvailableAndReady (t , suite .Client , opts , resources .SecondaryGatewayNN )
262
265
}
263
266
267
+ func getGatewayInferenceExtentionVersion (crds []apiextensionsv1.CustomResourceDefinition ) (string , error ) {
268
+ var inferenceVersion string
269
+ for _ , crd := range crds {
270
+ v , okv := crd .Annotations [version .BundleVersionAnnotation ]
271
+ if ! okv {
272
+ continue
273
+ }
274
+ if inferenceVersion != "" && v != inferenceVersion {
275
+ return "" , errors .New ("multiple gateway api inference extension CRDs versions detected" )
276
+ }
277
+ inferenceVersion = v
278
+ }
279
+ if inferenceVersion == "" {
280
+ return "" , errors .New ("no gateway api inference extension CRDs with the proper annotations found in the cluster" )
281
+ }
282
+ return inferenceVersion , nil
283
+ }
284
+
264
285
// ensureGatewayAvailableAndReady polls for the specified Gateway to exist and become ready
265
286
// with an address and programmed condition.
266
287
func ensureGatewayAvailableAndReady (t * testing.T , k8sClient client.Client , opts confsuite.ConformanceOptions , gatewayNN types.NamespacedName ) {
0 commit comments