Skip to content

Commit 4af4754

Browse files
committed
refactor: rename PreDeployment to Readiness across codebase and docs
1 parent 0463e2d commit 4af4754

File tree

7 files changed

+28
-29
lines changed

7 files changed

+28
-29
lines changed

docs/user/cli-reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ eidos validate \
542542
--kubeconfig ~/.kube/prod-cluster
543543
```
544544

545-
**Output Structure (Pre-Deployment Phase):**
545+
**Output Structure (Readiness Phase):**
546546
```yaml
547547
apiVersion: eidos.nvidia.com/v1alpha1
548548
kind: ValidationResult
@@ -590,10 +590,10 @@ metadata:
590590
recipeSource: recipe.yaml
591591
snapshotSource: snapshot.yaml
592592
summary:
593-
passed: 10
593+
passed: 3
594594
failed: 0
595-
skipped: 0
596-
total: 10
595+
skipped: 1
596+
total: 4
597597
status: pass
598598
duration: 58.4µs
599599
phases:

pkg/recipe/metadata.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ type ExpectedResource struct {
127127

128128
// ValidationConfig defines validation phases and settings.
129129
type ValidationConfig struct {
130-
// PreDeployment defines pre-deployment validation phase settings.
131-
PreDeployment *ValidationPhase `json:"preDeployment,omitempty" yaml:"preDeployment,omitempty"`
130+
// Readiness defines readiness validation phase settings.
131+
Readiness *ValidationPhase `json:"readiness,omitempty" yaml:"readiness,omitempty"`
132132

133133
// Deployment defines deployment validation phase settings.
134134
Deployment *ValidationPhase `json:"deployment,omitempty" yaml:"deployment,omitempty"`
@@ -377,8 +377,8 @@ func (s *RecipeMetadataSpec) Merge(other *RecipeMetadataSpec) {
377377
if s.Validation == nil {
378378
s.Validation = other.Validation
379379
} else {
380-
if other.Validation.PreDeployment != nil {
381-
s.Validation.PreDeployment = other.Validation.PreDeployment
380+
if other.Validation.Readiness != nil {
381+
s.Validation.Readiness = other.Validation.Readiness
382382
}
383383
if other.Validation.Deployment != nil {
384384
s.Validation.Deployment = other.Validation.Deployment

pkg/recipe/metadata_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func TestMergeValidationConfig(t *testing.T) {
487487
t.Run("overlay phases merge with base", func(t *testing.T) {
488488
base := RecipeMetadataSpec{
489489
Validation: &ValidationConfig{
490-
PreDeployment: &ValidationPhase{
490+
Readiness: &ValidationPhase{
491491
Checks: []string{"gpu-hardware-detection"},
492492
},
493493
Deployment: &ValidationPhase{
@@ -513,11 +513,11 @@ func TestMergeValidationConfig(t *testing.T) {
513513
if base.Validation == nil {
514514
t.Fatal("validation should not be nil after merge")
515515
}
516-
if base.Validation.PreDeployment == nil {
517-
t.Fatal("preDeployment should be preserved from base")
516+
if base.Validation.Readiness == nil {
517+
t.Fatal("readiness should be preserved from base")
518518
}
519-
if base.Validation.PreDeployment.Checks[0] != "gpu-hardware-detection" {
520-
t.Error("preDeployment checks should be preserved from base")
519+
if base.Validation.Readiness.Checks[0] != "gpu-hardware-detection" {
520+
t.Error("readiness checks should be preserved from base")
521521
}
522522
if base.Validation.Deployment.Timeout != "10m" {
523523
t.Errorf("deployment timeout = %q, want 10m (from overlay)", base.Validation.Deployment.Timeout)

pkg/validator/checks/runner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ func (r *TestRunner) HasCheck(phase, checkName string) bool {
156156

157157
var checkList []string
158158
switch phase {
159-
case "readiness", "preDeployment":
160-
if r.ctx.Recipe.Validation.PreDeployment != nil {
161-
checkList = r.ctx.Recipe.Validation.PreDeployment.Checks
159+
case "readiness":
160+
if r.ctx.Recipe.Validation.Readiness != nil {
161+
checkList = r.ctx.Recipe.Validation.Readiness.Checks
162162
}
163163
case "deployment":
164164
if r.ctx.Recipe.Validation.Deployment != nil {

pkg/validator/checks/runner_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func TestLoadValidationContext_InvalidRecipeData(t *testing.T) {
360360
func TestTestRunner_HasCheck(t *testing.T) {
361361
recipeResult := &recipe.RecipeResult{
362362
Validation: &recipe.ValidationConfig{
363-
PreDeployment: &recipe.ValidationPhase{
363+
Readiness: &recipe.ValidationPhase{
364364
Checks: []string{"gpu-hardware-detection"},
365365
},
366366
Deployment: &recipe.ValidationPhase{
@@ -392,7 +392,6 @@ func TestTestRunner_HasCheck(t *testing.T) {
392392
want bool
393393
}{
394394
{"readiness phase has check", "readiness", "gpu-hardware-detection", true},
395-
{"preDeployment alias", "preDeployment", "gpu-hardware-detection", true},
396395
{"readiness phase missing check", "readiness", "nonexistent", false},
397396
{"deployment phase has check", "deployment", "operator-health", true},
398397
{"deployment phase has second check", "deployment", "check-nvidia-smi", true},

pkg/validator/phases.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,10 @@ func (v *Validator) validateReadiness(
293293
// For multi-phase validation, validateAll() manages RBAC lifecycle.
294294
// For single-phase validation, the CLI/API should call agent.EnsureRBAC() first.
295295
//nolint:dupl // Phase validation methods have similar structure by design
296-
if recipeResult.Validation != nil && recipeResult.Validation.PreDeployment != nil && len(recipeResult.Validation.PreDeployment.Checks) > 0 {
296+
if recipeResult.Validation != nil && recipeResult.Validation.Readiness != nil && len(recipeResult.Validation.Readiness.Checks) > 0 {
297297
if v.NoCluster {
298298
slog.Info("no-cluster mode enabled, skipping cluster check execution for readiness phase")
299-
for _, checkName := range recipeResult.Validation.PreDeployment.Checks {
299+
for _, checkName := range recipeResult.Validation.Readiness.Checks {
300300
check := CheckResult{
301301
Name: checkName,
302302
Status: ValidationStatusPass,
@@ -310,9 +310,9 @@ func (v *Validator) validateReadiness(
310310
// If Kubernetes is not available (e.g., running in test mode), skip check execution
311311
slog.Warn("Kubernetes client unavailable, skipping check execution",
312312
"error", err,
313-
"checks", len(recipeResult.Validation.PreDeployment.Checks))
313+
"checks", len(recipeResult.Validation.Readiness.Checks))
314314
// Add skeleton check results
315-
for _, checkName := range recipeResult.Validation.PreDeployment.Checks {
315+
for _, checkName := range recipeResult.Validation.Readiness.Checks {
316316
check := CheckResult{
317317
Name: checkName,
318318
Status: ValidationStatusPass,
@@ -336,7 +336,7 @@ func (v *Validator) validateReadiness(
336336
RecipeConfigMap: recipeCMName,
337337
TestPackage: "./pkg/validator/checks/readiness",
338338
TestPattern: "", // Run all tests in package
339-
Timeout: resolvePhaseTimeout(recipeResult.Validation.PreDeployment, DefaultReadinessTimeout),
339+
Timeout: resolvePhaseTimeout(recipeResult.Validation.Readiness, DefaultReadinessTimeout),
340340
}
341341

342342
deployer := agent.NewDeployer(clientset, jobConfig)

pkg/validator/phases_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestValidatePhase(t *testing.T) {
108108
}
109109
}
110110

111-
func TestValidatePreDeployment(t *testing.T) {
111+
func TestValidateReadiness(t *testing.T) {
112112
// Skip if running with -short flag (for fast unit tests)
113113
if testing.Short() {
114114
t.Skip("Skipping integration test in short mode")
@@ -136,7 +136,7 @@ func TestValidatePreDeployment(t *testing.T) {
136136
{Name: "OS.release.ID", Value: "ubuntu"},
137137
},
138138
validationConfig: &recipe.ValidationConfig{
139-
PreDeployment: &recipe.ValidationPhase{
139+
Readiness: &recipe.ValidationPhase{
140140
Checks: []string{"gpu-hardware-detection", "kernel-parameters"},
141141
},
142142
},
@@ -445,8 +445,8 @@ func TestValidateAll_PhaseOrder(t *testing.T) {
445445
}
446446

447447
// Verify readiness has constraint results
448-
preDeployPhase := result.Phases["readiness"]
449-
if len(preDeployPhase.Constraints) == 0 {
448+
readinessPhase := result.Phases["readiness"]
449+
if len(readinessPhase.Constraints) == 0 {
450450
t.Error("readiness phase should have constraint results")
451451
}
452452

@@ -540,7 +540,7 @@ func createTestRecipeWithValidation() *recipe.RecipeResult {
540540
{Name: "OS.release.ID", Value: "ubuntu"},
541541
},
542542
Validation: &recipe.ValidationConfig{
543-
PreDeployment: &recipe.ValidationPhase{
543+
Readiness: &recipe.ValidationPhase{
544544
Checks: []string{"gpu-hardware-detection", "kernel-parameters", "os-prerequisites"},
545545
},
546546
Deployment: &recipe.ValidationPhase{
@@ -1018,7 +1018,7 @@ func TestValidateRecipeRegistrations(t *testing.T) {
10181018
name: "readiness - no constraint validators to check",
10191019
recipe: &recipe.RecipeResult{
10201020
Validation: &recipe.ValidationConfig{
1021-
PreDeployment: &recipe.ValidationPhase{
1021+
Readiness: &recipe.ValidationPhase{
10221022
Checks: []string{"gpu-hardware-detection"},
10231023
},
10241024
},

0 commit comments

Comments
 (0)