Skip to content

Commit

Permalink
Add test cases for Summarize() and DetermineReleaseState()
Browse files Browse the repository at this point in the history
Signed-off-by: Soule BA <[email protected]>
  • Loading branch information
souleb committed May 7, 2024
1 parent 4069ad4 commit dd97816
Show file tree
Hide file tree
Showing 6 changed files with 468 additions and 319 deletions.
1 change: 0 additions & 1 deletion docs/spec/v2/helmreleases.md
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,6 @@ attempted to perform a Helm install or upgrade with in the
The digest is used to determine if the controller should reset the
[failure counters](#failure-counters) due to a change in the values.


### Last Attempted Revision

The helm-controller reports the revision of the Helm chart it last attempted
Expand Down
10 changes: 6 additions & 4 deletions internal/controller/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,13 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, patchHelpe
conditions.MarkUnknown(obj, meta.ReadyCondition, meta.ProgressingReason, "reconciliation in progress")
}

// Attempt to adopt "legacy" v2beta1 release state on a best-effort basis.
// If this fails, the controller will fall back to performing an upgrade
// to settle on the desired state.
// TODO(hidde): remove this in a future release.
// Keep feature flagged code paths separate from the main reconciliation
// logic to ensure easy removal when the feature flag is removed.
if ok, _ := features.Enabled(features.AdoptLegacyReleases); ok {
// Attempt to adopt "legacy" v2beta1 release state on a best-effort basis.
// If this fails, the controller will fall back to performing an upgrade
// to settle on the desired state.
// TODO(hidde): remove this in a future release.
if err := r.adoptLegacyRelease(ctx, getter, obj); err != nil {
log.Error(err, "failed to adopt v2beta1 release state")
}
Expand Down
3 changes: 0 additions & 3 deletions internal/controller/helmrelease_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,9 +1197,6 @@ func TestHelmReleaseReconciler_reconcileReleaseFromHelmChartSource(t *testing.T)
chartMock := testutil.BuildChart()
chartArtifact, err := testutil.SaveChartAsArtifact(chartMock, digest.SHA256, testServer.URL(), testServer.Root())
g.Expect(err).ToNot(HaveOccurred())
// copy the artifact to mutate the revision
ociArtifact := chartArtifact.DeepCopy()
ociArtifact.Revision += "@" + chartArtifact.Digest

ns, err := testEnv.CreateNamespace(context.TODO(), "mock")
g.Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion internal/postrender/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package postrender
import (
"encoding/json"

"github.com/opencontainers/go-digest"
helmpostrender "helm.sh/helm/v3/pkg/postrender"

v2 "github.com/fluxcd/helm-controller/api/v2"
"github.com/opencontainers/go-digest"
)

// BuildPostRenderers creates the post-renderer instances from a HelmRelease
Expand Down
Loading

0 comments on commit dd97816

Please sign in to comment.