@@ -68,43 +68,57 @@ 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 ) {
74-
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 {
7589 t .Helper ()
7690
7791 result , err := NewBuilder ().BuildFromCriteriaWithProfile (ctx , criteria , selection )
7892 if err != nil {
7993 t .Fatalf ("BuildFromCriteriaWithProfile(%s, %q): %v" , criteria .String (), selection , err )
8094 }
81- if result .Validation == nil || result .Validation .Deployment == nil {
95+ if result .Validation == nil {
96+ return nil
97+ }
98+ return result .Validation .Deployment
99+ }
100+
101+ // driverFloorOf returns the declared host driver floor in a resolved deployment
102+ // phase, if any.
103+ func driverFloorOf (deployment * ValidationPhase ) (string , bool ) {
104+ if deployment == nil {
82105 return "" , false
83106 }
84- for _ , c := range result . Validation . Deployment .Constraints {
107+ for _ , c := range deployment .Constraints {
85108 if c .Name == gpuDriverFloorConstraint {
86109 return c .Value , true
87110 }
88111 }
89112 return "" , false
90113}
91114
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 {
115+ // deploymentHasCheck reports whether a resolved deployment phase declares the
116+ // named check. A floor with no check to evaluate it is inert.
117+ func deploymentHasCheck (deployment * ValidationPhase , name string ) bool {
118+ if deployment == nil {
105119 return false
106120 }
107- for _ , c := range result . Validation . Deployment .Checks {
121+ for _ , c := range deployment .Checks {
108122 if c == name {
109123 return true
110124 }
@@ -228,7 +242,8 @@ func TestGPUDriverFloorEffectiveValue(t *testing.T) {
228242 t .Run (tt .name , func (t * testing.T ) {
229243 t .Parallel ()
230244
231- got , found := resolvedDriverFloor (t , ctx , tt .criteria , "" )
245+ deployment := resolvedDeployment (ctx , t , tt .criteria , "" )
246+ got , found := driverFloorOf (deployment )
232247 if ! found {
233248 t .Fatalf ("%s resolved with no %s constraint; want %q.\n " +
234249 "A floor declared upstream was dropped, or the leaf no longer " +
@@ -245,7 +260,7 @@ func TestGPUDriverFloorEffectiveValue(t *testing.T) {
245260
246261 // A floor with no check to evaluate it is inert: check-nvidia-smi
247262 // is the only consumer of this constraint.
248- if ! hasDeploymentCheck ( t , ctx , tt . criteria , "check-nvidia-smi" ) {
263+ if ! deploymentHasCheck ( deployment , "check-nvidia-smi" ) {
249264 t .Errorf ("%s declares %s but the resolved deployment phase has no " +
250265 "check-nvidia-smi check, so nothing evaluates the floor" ,
251266 tt .criteria .String (), gpuDriverFloorConstraint )
0 commit comments