fix(test): restore --cleanup

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
pull/6217/head
Matthew Fisher 6 years ago
parent 29d6853659
commit fddf066121
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -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)
}

Loading…
Cancel
Save