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>
pull/32402/head
Jan Braje 3 months ago
parent 344c1ae3c2
commit e9ae6b68e3
No known key found for this signature in database
GPG Key ID: AA98A2FCFE70D0C9

@ -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) {

@ -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)
})
}

@ -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,

Loading…
Cancel
Save