Skip to content

Commit

Permalink
Merge pull request #7830 from jgleonard/render-subchart-notes-on-upgr…
Browse files Browse the repository at this point in the history
…ade-install

Render subchart notes on upgrade install
  • Loading branch information
hickeyma committed Mar 31, 2020
2 parents 783be10 + f927275 commit 06b43f6
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
description: Chart with subchart notes
name: chart-with-subchart-notes
version: 0.0.1
dependencies:
- name: subchart-with-notes
version: 0.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
description: Subchart with notes
name: subchart-with-notes
version: 0.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBCHART NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PARENT NOTES
1 change: 1 addition & 0 deletions cmd/helm/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
instClient.Atomic = client.Atomic
instClient.PostRenderer = client.PostRenderer
instClient.DisableOpenAPIValidation = client.DisableOpenAPIValidation
instClient.SubNotes = client.SubNotes

rel, err := runInstall(args, instClient, valueOpts, out)
if err != nil {
Expand Down
32 changes: 32 additions & 0 deletions cmd/helm/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,38 @@ func TestUpgradeWithStringValue(t *testing.T) {

}

func TestUpgradeInstallWithSubchartNotes(t *testing.T) {

releaseName := "wacky-bunny-v1"
relMock, ch, _ := prepareMockRelease(releaseName, t)

defer resetEnv()()

store := storageFixture()

store.Create(relMock(releaseName, 1, ch))

cmd := fmt.Sprintf("upgrade %s -i --render-subchart-notes '%s'", releaseName, "testdata/testcharts/chart-with-subchart-notes")
_, _, err := executeActionCommandC(store, cmd)
if err != nil {
t.Errorf("unexpected error, got '%v'", err)
}

upgradedRel, err := store.Get(releaseName, 2)
if err != nil {
t.Errorf("unexpected error, got '%v'", err)
}

if !strings.Contains(upgradedRel.Info.Notes, "PARENT NOTES") {
t.Errorf("The parent notes are not set correctly. NOTES: %s", upgradedRel.Info.Notes)
}

if !strings.Contains(upgradedRel.Info.Notes, "SUBCHART NOTES") {
t.Errorf("The subchart notes are not set correctly. NOTES: %s", upgradedRel.Info.Notes)
}

}

func TestUpgradeWithValuesFile(t *testing.T) {

releaseName := "funny-bunny-v4"
Expand Down

0 comments on commit 06b43f6

Please sign in to comment.