fix(release_server): handle the case when requested values is empty (#4604)

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
pull/4608/head
Matthew Fisher 6 years ago committed by GitHub
parent 37a731db79
commit 941b1f4d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -139,7 +139,11 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current
// merge new values with current
if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" {
req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw
if req.Values.Raw != "{}\n" {
req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw
} else {
req.Values.Raw = current.Config.Raw + "\n"
}
}
req.Chart.Values = &chart.Config{Raw: nv}

@ -159,12 +159,11 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) {
{Name: "templates/hello", Data: []byte("hello: world")},
},
},
Values: &chart.Config{Raw: ""},
Values: &chart.Config{Raw: "{}\n"},
ReuseValues: true,
}
_, err = rs.UpdateRelease(c, req)
if err != nil {
if _, err := rs.UpdateRelease(c, req); err != nil {
t.Fatalf("Failed updated: %s", err)
}
}

Loading…
Cancel
Save