From 697c7984bff4dab3a79fe223da1d5f92b24b2a5f Mon Sep 17 00:00:00 2001 From: Gergely Brautigam <182850+Skarlso@users.noreply.github.com> Date: Fri, 10 May 2024 12:17:53 +0200 Subject: [PATCH] fix the configuration test and removal of folder --- controllers/configuration_controller_test.go | 4 ++-- controllers/mutation_reconcile_looper.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/configuration_controller_test.go b/controllers/configuration_controller_test.go index a8472b35..b87517bf 100644 --- a/controllers/configuration_controller_test.go +++ b/controllers/configuration_controller_test.go @@ -331,7 +331,7 @@ func TestConfigurationReconciler(t *testing.T) { }, { name: "error while running configurator", - expectError: "configurator error: error while doing cascade with: processing template adjustments: unresolved nodes:\n\t(( nope ))\tin template adjustments\tadjustments.[0].value\t(adjustments.name:subst-0.value)\t*'nope' not found", + expectError: "failed to apply config ref: failed to configure resource: configurator error: error while doing cascade with: processing template ocmAdjustmentsTemplateKey: unresolved nodes:\n\t(( nope ))\tin template ocmAdjustmentsTemplateKey\tocmAdjustmentsTemplateKey.[0].value\t(ocmAdjustmentsTemplateKey.name:subst-0.value)\t*'nope' not found", componentVersion: func() *v1alpha1.ComponentVersion { cv := DefaultComponent.DeepCopy() cv.Status.ObservedGeneration = 5 @@ -794,7 +794,7 @@ configuration: }, }, } - for i, tt := range testCases[len(testCases)-1:] { + for i, tt := range testCases { t.Run(fmt.Sprintf("%d: %s", i, tt.name), func(t *testing.T) { cv := tt.componentVersion() conditions.MarkTrue(cv, meta.ReadyCondition, meta.SucceededReason, "test") diff --git a/controllers/mutation_reconcile_looper.go b/controllers/mutation_reconcile_looper.go index 2c952fc1..40fb319c 100644 --- a/controllers/mutation_reconcile_looper.go +++ b/controllers/mutation_reconcile_looper.go @@ -968,13 +968,13 @@ func (m *MutationReconcileLooper) mutatePatchStrategicMerge( mutationSpec *v1alpha1.MutationSpec, sourceData []byte, ) (string, ocmmetav1.Identity, error) { + // DO NOT Defer remove this, it will be removed once it has been tarred. tmpDir, err := os.MkdirTemp("", "kustomization-") if err != nil { err = fmt.Errorf("tmp dir error: %w", err) return "", ocmmetav1.Identity{}, err } - defer os.RemoveAll(tmpDir) gitSource, err := m.getSource(ctx, mutationSpec.PatchStrategicMerge.Source.SourceRef) if err != nil {