From e9ae6b68e370b34a4129d1756efa019ccc3c8f6f Mon Sep 17 00:00:00 2001 From: Jan Braje <12571346+janluak@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:36:51 +0200 Subject: [PATCH] remove default behavior in action/bump since command/bump doesn't allow default bump type Signed-off-by: Jan Braje <12571346+janluak@users.noreply.github.com> --- pkg/action/bump.go | 7 ------- pkg/action/bump_test.go | 19 ------------------- pkg/cmd/bump_test.go | 4 ++-- .../{bump-default.txt => bump-patch.txt} | 0 4 files changed, 2 insertions(+), 28 deletions(-) rename pkg/cmd/testdata/output/{bump-default.txt => bump-patch.txt} (100%) diff --git a/pkg/action/bump.go b/pkg/action/bump.go index 530321b25..64ed33322 100644 --- a/pkg/action/bump.go +++ b/pkg/action/bump.go @@ -42,8 +42,6 @@ type Bump struct { chart *chart.Chart } -const defaultBumpType = "patch" - // NewBump creates a new Bump object with the given configuration. func NewBump(cfg *Configuration) *Bump { return &Bump{ @@ -64,12 +62,7 @@ func (b *Bump) Run(bumpType string, chartpath string) (string, error) { if err != nil { return "", err } - // Determine new version based on bump type or explicit version b.bump = bumpType - if b.bump == "" { - // Default to "patch" if no version specified - b.bump = defaultBumpType - } currentVersion := strings.TrimSpace(string(cv)) if !isValidVersion(currentVersion) { diff --git a/pkg/action/bump_test.go b/pkg/action/bump_test.go index b756f7eca..7505a792d 100644 --- a/pkg/action/bump_test.go +++ b/pkg/action/bump_test.go @@ -414,22 +414,3 @@ func TestBump_IsValidVersion(t *testing.T) { }) } } - -func TestBump_Run_WithDefault(t *testing.T) { - t.Parallel() - - cfg := actionConfigFixture(t) - client := NewBump(cfg) - client.chart = &chart.Chart{ - Metadata: &chart.Metadata{Name: "test"}, - } - - // Test that it properly handles the default case - t.Run("Patch bump with valid version", func(t *testing.T) { - client.chart.Metadata.Version = "1.2.3" - result, err := client.Run("patch", "") - require.NoError(t, err) - require.Equal(t, "1.2.4", result) - require.Equal(t, "patch", client.bump) - }) -} diff --git a/pkg/cmd/bump_test.go b/pkg/cmd/bump_test.go index f2ab5469b..4b2aae213 100644 --- a/pkg/cmd/bump_test.go +++ b/pkg/cmd/bump_test.go @@ -54,8 +54,8 @@ func TestBump(t *testing.T) { wantError: true, }, { name: "default", - cmd: "bump " + tempChartDir, - golden: "output/bump-default.txt", + cmd: "bump patch " + tempChartDir, + golden: "output/bump-patch.txt", }, { name: "with bump type", cmd: "bump minor " + tempChartDir, diff --git a/pkg/cmd/testdata/output/bump-default.txt b/pkg/cmd/testdata/output/bump-patch.txt similarity index 100% rename from pkg/cmd/testdata/output/bump-default.txt rename to pkg/cmd/testdata/output/bump-patch.txt