Skip to content

Commit

Permalink
Add upgrade dependency update test
Browse files Browse the repository at this point in the history
Signed-off-by: David Mládek <david.mladek.cz@gmail.com>
  • Loading branch information
mladedav committed May 5, 2021
1 parent d6eab46 commit cea906a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/helm/testdata/output/upgrade-with-dependency-update.txt
@@ -0,0 +1,9 @@
Release "funny-bunny" has been upgraded. Happy Helming!
NAME: funny-bunny
LAST DEPLOYED: Fri Sep 2 22:04:05 1977
NAMESPACE: default
STATUS: deployed
REVISION: 3
TEST SUITE: None
NOTES:
PARENT NOTES
@@ -0,0 +1,6 @@
dependencies:
- name: subchart-with-notes
repository: file://../chart-with-subchart-notes/charts/subchart-with-notes
version: 0.0.1
digest: sha256:8ca45f73ae3f6170a09b64a967006e98e13cd91eb51e5ab0599bb87296c7df0a
generated: "2021-05-02T15:07:22.1099921+02:00"
8 changes: 8 additions & 0 deletions cmd/helm/upgrade_test.go
Expand Up @@ -32,6 +32,7 @@ import (
)

func TestUpgradeCmd(t *testing.T) {

tmpChart := ensure.TempDir(t)
cfile := &chart.Chart{
Metadata: &chart.Metadata{
Expand Down Expand Up @@ -79,6 +80,7 @@ func TestUpgradeCmd(t *testing.T) {

missingDepsPath := "testdata/testcharts/chart-missing-deps"
badDepsPath := "testdata/testcharts/chart-bad-requirements"
presentDepsPath := "testdata/testcharts/chart-with-subchart-update"

relWithStatusMock := func(n string, v int, ch *chart.Chart, status release.Status) *release.Release {
return release.Mock(&release.MockReleaseOptions{Name: n, Version: v, Chart: ch, Status: status})
Expand Down Expand Up @@ -149,6 +151,12 @@ func TestUpgradeCmd(t *testing.T) {
golden: "output/upgrade-with-bad-dependencies.txt",
wantError: true,
},
{
name: "upgrade a release with resolving missing dependencies",
cmd: fmt.Sprintf("upgrade --dependency-update funny-bunny %s", presentDepsPath),
golden: "output/upgrade-with-dependency-update.txt",
rels: []*release.Release{relMock("funny-bunny", 2, ch2)},
},
{
name: "upgrade a non-existent release",
cmd: fmt.Sprintf("upgrade funny-bunny '%s'", chartPath),
Expand Down

0 comments on commit cea906a

Please sign in to comment.