Skip to content

Commit

Permalink
Merge pull request #521 from Praqma/run-helm-tests-as-hooks-after-com…
Browse files Browse the repository at this point in the history
…mands

Run helm tests as a last command of after commands from hooks
  • Loading branch information
luisdavim authored Oct 6, 2020
2 parents b56f7fe + 1f7db4f commit 12dd3e9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/app/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,21 @@ func getChartVersion(chart, version string) (string, string) {
}

// testRelease creates a Helm command to test a particular release.
func (r *release) test(p *plan) {
func (r *release) test(afterCommands *[]command) {
cmd := helmCmd(r.getHelmArgsFor("test"), "Running tests for release [ "+r.Name+" ] in namespace [ "+r.Namespace+" ]")
p.addCommand(cmd, r.Priority, r, []command{}, []command{})
*afterCommands = append(*afterCommands, cmd)
}

// installRelease creates a Helm command to install a particular release in a particular namespace using a particular Tiller.
func (r *release) install(p *plan) {

before, after := r.checkHooks("install", p)
cmd := helmCmd(r.getHelmArgsFor("install"), "Install release [ "+r.Name+" ] version [ "+r.Version+" ] in namespace [ "+r.Namespace+" ]")
p.addCommand(cmd, r.Priority, r, before, after)

if r.Test {
r.test(p)
r.test(&after)
}

cmd := helmCmd(r.getHelmArgsFor("install"), "Install release [ "+r.Name+" ] version [ "+r.Version+" ] in namespace [ "+r.Namespace+" ]")
p.addCommand(cmd, r.Priority, r, before, after)
}

// uninstall uninstalls a release
Expand Down Expand Up @@ -358,14 +358,14 @@ func (r *release) upgrade(p *plan) {

before, after := r.checkHooks("upgrade", p)

if r.Test {
r.test(&after)
}

cmd := helmCmd(r.getHelmArgsFor("upgrade"), "Upgrade release [ "+r.Name+" ] to version [ "+r.Version+" ] in namespace [ "+r.Namespace+" ]")

p.addCommand(cmd, r.Priority, r, before, after)

if r.Test {
r.test(p)
}

}

// reInstall uninstalls a release and reinstalls it.
Expand Down

0 comments on commit 12dd3e9

Please sign in to comment.