@@ -68,43 +68,58 @@ const rtxProDriverFloor = ">= 575.57.08"
6868// value for criteria under the given profile selection, and whether one was
6969// declared at all. It goes through the production resolver so the assertion
7070// covers wildcard contributions, mixins, and profile application.
71- func resolvedDriverFloor (
72- t * testing.T , ctx context.Context , criteria * Criteria , selection string ,
73- ) (string , bool ) {
71+ // resolvedDeployment resolves a recipe once and returns its deployment
72+ // validation phase, so a caller asserting both the floor and the check that
73+ // evaluates it does not build the same recipe twice.
74+ //
75+ // selection is threaded through even though every current call passes "":
76+ // no overlay in the RTX PRO 6000 EKS or LKE chains declares a profile (only
77+ // aks.yaml and gke-cos.yaml do anywhere in the catalog), and selecting a
78+ // profile against a composition that declares none is rejected at resolution.
79+ // There is therefore no alternate-profile dimension to exercise for these
80+ // leaves rather than an untested one.
81+ //
82+ // Note also that a profile could not downgrade this floor even where one does
83+ // exist: ProfileValue.constraints are validated as measurement paths at catalog
84+ // load (constraint_paths.go), and Deployment is not a measurement Type, so a
85+ // profile value cannot carry a Deployment.gpu-driver.version constraint at all.
86+ func resolvedDeployment (
87+ ctx context.Context , t * testing.T , criteria * Criteria , selection string ,
88+ ) * ValidationPhase {
7489
7590 t .Helper ()
7691
7792 result , err := NewBuilder ().BuildFromCriteriaWithProfile (ctx , criteria , selection )
7893 if err != nil {
7994 t .Fatalf ("BuildFromCriteriaWithProfile(%s, %q): %v" , criteria .String (), selection , err )
8095 }
81- if result .Validation == nil || result .Validation .Deployment == nil {
96+ if result .Validation == nil {
97+ return nil
98+ }
99+ return result .Validation .Deployment
100+ }
101+
102+ // driverFloorOf returns the declared host driver floor in a resolved deployment
103+ // phase, if any.
104+ func driverFloorOf (deployment * ValidationPhase ) (string , bool ) {
105+ if deployment == nil {
82106 return "" , false
83107 }
84- for _ , c := range result . Validation . Deployment .Constraints {
108+ for _ , c := range deployment .Constraints {
85109 if c .Name == gpuDriverFloorConstraint {
86110 return c .Value , true
87111 }
88112 }
89113 return "" , false
90114}
91115
92- // hasDeploymentCheck reports whether the resolved deployment phase declares
93- // the named check. A floor with no check to evaluate it is inert.
94- func hasDeploymentCheck (
95- t * testing.T , ctx context.Context , criteria * Criteria , name string ,
96- ) bool {
97-
98- t .Helper ()
99-
100- result , err := NewBuilder ().BuildFromCriteriaWithProfile (ctx , criteria , "" )
101- if err != nil {
102- t .Fatalf ("BuildFromCriteriaWithProfile(%s): %v" , criteria .String (), err )
103- }
104- if result .Validation == nil || result .Validation .Deployment == nil {
116+ // deploymentHasCheck reports whether a resolved deployment phase declares the
117+ // named check. A floor with no check to evaluate it is inert.
118+ func deploymentHasCheck (deployment * ValidationPhase , name string ) bool {
119+ if deployment == nil {
105120 return false
106121 }
107- for _ , c := range result . Validation . Deployment .Checks {
122+ for _ , c := range deployment .Checks {
108123 if c == name {
109124 return true
110125 }
@@ -228,7 +243,8 @@ func TestGPUDriverFloorEffectiveValue(t *testing.T) {
228243 t .Run (tt .name , func (t * testing.T ) {
229244 t .Parallel ()
230245
231- got , found := resolvedDriverFloor (t , ctx , tt .criteria , "" )
246+ deployment := resolvedDeployment (ctx , t , tt .criteria , "" )
247+ got , found := driverFloorOf (deployment )
232248 if ! found {
233249 t .Fatalf ("%s resolved with no %s constraint; want %q.\n " +
234250 "A floor declared upstream was dropped, or the leaf no longer " +
@@ -245,7 +261,7 @@ func TestGPUDriverFloorEffectiveValue(t *testing.T) {
245261
246262 // A floor with no check to evaluate it is inert: check-nvidia-smi
247263 // is the only consumer of this constraint.
248- if ! hasDeploymentCheck ( t , ctx , tt . criteria , "check-nvidia-smi" ) {
264+ if ! deploymentHasCheck ( deployment , "check-nvidia-smi" ) {
249265 t .Errorf ("%s declares %s but the resolved deployment phase has no " +
250266 "check-nvidia-smi check, so nothing evaluates the floor" ,
251267 tt .criteria .String (), gpuDriverFloorConstraint )
0 commit comments