@@ -134,11 +134,15 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
134134 * confflags .ImplementationContact ,
135135 )
136136
137+ << << << < HEAD
137138 // Inference Extension Specific Report Fields
138139 inferenceExtensionVersion := "v0.3.0"
139140 _ = inferenceExtensionVersion // Avoid unused variable error until implemented
140141
141142 baseManifestsValue := "resources/base.yaml"
143+ == == == =
144+ baseManifestsValue := "resources/manifests/manifests.yaml"
145+ >> >> >> > e9e8993 (Use CRD annotation to get the inferencePool BundleVersion for ConformanceReport.)
142146
143147 opts := confsuite.ConformanceOptions {
144148 Client : c ,
@@ -166,7 +170,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
166170 // TODO: Add the inference extension specific fields to ConformanceOptions struct if needed,
167171 // or handle them during report generation.
168172 // GatewayAPIInferenceExtensionChannel: inferenceExtensionChannel,
169- // GatewayAPIInferenceExtensionVersion: inferenceExtensionVersion,
170173 }
171174
172175 // Populate SupportedFeatures based on the GatewayLayerProfile.
@@ -209,19 +212,28 @@ func RunConformanceWithOptions(t *testing.T, opts confsuite.ConformanceOptions)
209212 cSuite , err := confsuite .NewConformanceTestSuite (opts )
210213 require .NoError (t , err , "error initializing conformance suite" )
211214
215+ installedCRDs := & apiextensionsv1.CustomResourceDefinitionList {}
216+ err = opts .Client .List (context .TODO (), installedCRDs )
217+ require .NoError (t , err , "error getting installedCRDs" )
218+ apiVersion , err := getGatewayInferenceExtentionVersion (installedCRDs .Items )
219+ if err != nil {
220+ if opts .AllowCRDsMismatch {
221+ apiVersion = "UNDEFINED"
222+ } else {
223+ require .NoError (t , err , "error getting the gateway ineference extension version" )
224+ }
225+ }
212226 SetupConformanceTestSuite (t , cSuite , opts , tests .ConformanceTests )
213-
214227 t .Log ("Running Inference Extension conformance tests against all registered tests" )
215228 err = cSuite .Run (t , tests .ConformanceTests )
216229 require .NoError (t , err , "error running conformance tests" )
217230
218- // Generate and write the report if requested.
219231 if opts .ReportOutputPath != "" {
220232 t .Log ("Generating Inference Extension conformance report" )
221233 report , err := cSuite .Report () // Use the existing report generation logic.
222234 require .NoError (t , err , "error generating conformance report" )
223235 inferenceReport := GatewayAPIInferenceExtensionConformanceReport {
224- GatewayAPIInferenceExtensionVersion : version . BundleVersion ,
236+ GatewayAPIInferenceExtensionVersion : apiVersion ,
225237 ConformanceReport : * report ,
226238 }
227239 err = inferenceReport .WriteReport (t .Logf , opts .ReportOutputPath )
@@ -261,6 +273,24 @@ func SetupConformanceTestSuite(t *testing.T, suite *confsuite.ConformanceTestSui
261273 ensureGatewayAvailableAndReady (t , suite .Client , opts , resources .SecondaryGatewayNN )
262274}
263275
276+ func getGatewayInferenceExtentionVersion (crds []apiextensionsv1.CustomResourceDefinition ) (string , error ) {
277+ var inferenceVersion string
278+ for _ , crd := range crds {
279+ v , okv := crd .Annotations [version .BundleVersionAnnotation ]
280+ if ! okv {
281+ continue
282+ }
283+ if inferenceVersion != "" && v != inferenceVersion {
284+ return "" , errors .New ("multiple gateway api inference extension CRDs versions detected" )
285+ }
286+ inferenceVersion = v
287+ }
288+ if inferenceVersion == "" {
289+ return "" , errors .New ("no gateway api inference extension CRDs with the proper annotations found in the cluster" )
290+ }
291+ return inferenceVersion , nil
292+ }
293+
264294// ensureGatewayAvailableAndReady polls for the specified Gateway to exist and become ready
265295// with an address and programmed condition.
266296func ensureGatewayAvailableAndReady (t * testing.T , k8sClient client.Client , opts confsuite.ConformanceOptions , gatewayNN types.NamespacedName ) {
0 commit comments