mirror of
https://github.com/helm/helm.git
synced 2026-08-04 23:20:49 +00:00
fix(test): restore --cleanup
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
This commit is contained in:
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package action
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -58,5 +60,21 @@ func (r *ReleaseTesting) Run(name string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if r.Cleanup {
|
||||
for _, h := range rel.Hooks {
|
||||
for _, e := range h.Events {
|
||||
if e == release.HookTest {
|
||||
hookResource, err := r.cfg.KubeClient.Build(bytes.NewBufferString(h.Manifest))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "unable to build kubernetes object for %s hook %s", h, h.Path)
|
||||
}
|
||||
if _, errs := r.cfg.KubeClient.Delete(hookResource); errs != nil {
|
||||
return fmt.Errorf("unable to delete kubernetes object for %s hook %s: %s", h, h.Path, joinErrors(errs))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return r.cfg.Releases.Update(rel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user