From 4eed172adfd384d04d7a1b55fd2537ce8c32b938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20H=C3=B6rl?= Date: Fri, 15 Mar 2024 07:56:21 +0100 Subject: [PATCH] Rename template class for steps which take values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hannes Hörl --- pkg/packageinstall/app.go | 16 ++++++++-------- pkg/packageinstall/app_test.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/packageinstall/app.go b/pkg/packageinstall/app.go index 78710b713..1a3aa77f8 100644 --- a/pkg/packageinstall/app.go +++ b/pkg/packageinstall/app.go @@ -125,7 +125,7 @@ type ( const ( // anything that can take values - stepClassValueable stepClass = "valueable" + stepClassTakesValues stepClass = "takesValues" // only helm template steps stepClassHelm stepClass = "helm" // only ytt template steps @@ -150,13 +150,13 @@ func (p *templateStepsPatcher) classifySteps() { classes := stepClasses{} if step.HelmTemplate != nil { - classes.Insert(stepClassHelm, stepClassValueable) + classes.Insert(stepClassHelm, stepClassTakesValues) } if step.Ytt != nil { - classes.Insert(stepClassYtt, stepClassValueable) + classes.Insert(stepClassYtt, stepClassTakesValues) } if step.Cue != nil { - classes.Insert(stepClassCue, stepClassValueable) + classes.Insert(stepClassCue, stepClassTakesValues) } p.classifiedSteps[i] = classes @@ -213,11 +213,11 @@ func (p *templateStepsPatcher) patch() error { return nil } -// patchFromValues patches all 'valueable' template steps with values from the -// packageInstall +// patchFromValues patches all template steps that take values with values from +// the packageInstall func (p *templateStepsPatcher) patchFromValues() error { for _, values := range p.values { - stepIdxs, err := p.defaultStepIdxs(values.TemplateSteps, stepClassValueable) + stepIdxs, err := p.defaultStepIdxs(values.TemplateSteps, stepClassTakesValues) if err != nil { return err } @@ -226,7 +226,7 @@ func (p *templateStepsPatcher) patchFromValues() error { if stepIdx < 0 || stepIdx >= len(p.templateSteps) { return fmt.Errorf("template step %d out of range", stepIdx) } - if !p.stepHasClass(stepIdx, stepClassValueable) { + if !p.stepHasClass(stepIdx, stepClassTakesValues) { return fmt.Errorf("template step %d does not support values", stepIdx) } diff --git a/pkg/packageinstall/app_test.go b/pkg/packageinstall/app_test.go index 07536cff1..93927bd30 100644 --- a/pkg/packageinstall/app_test.go +++ b/pkg/packageinstall/app_test.go @@ -402,7 +402,7 @@ func TestAppPackageIntallValuesForTemplateSteps(t *testing.T) { }, exepectedErrMsg: "does not support values", }, - "some values, but no valueable step": { + "some values, but no steps which takes values": { values: []pkgingv1alpha1.PackageInstallValues{ {SecretRef: &pkgingv1alpha1.PackageInstallValuesSecretRef{Name: "foo-bar"}}, }, @@ -412,7 +412,7 @@ func TestAppPackageIntallValuesForTemplateSteps(t *testing.T) { {Sops: &kcv1alpha1.AppTemplateSops{}}, } }, - exepectedErrMsg: "no template step of class 'valueable' found", + exepectedErrMsg: "no template step of class 'takesValues' found", }, "values for specific steps": { values: []pkgingv1alpha1.PackageInstallValues{