|
|
|
@ -17,9 +17,6 @@ limitations under the License.
|
|
|
|
|
package action
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
@ -31,10 +28,8 @@ import (
|
|
|
|
|
//
|
|
|
|
|
// It provides the implementation of 'helm test'.
|
|
|
|
|
type ReleaseTesting struct {
|
|
|
|
|
cfg *Configuration
|
|
|
|
|
|
|
|
|
|
cfg *Configuration
|
|
|
|
|
Timeout time.Duration
|
|
|
|
|
Cleanup bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewReleaseTesting creates a new ReleaseTesting object with the given configuration.
|
|
|
|
@ -65,23 +60,5 @@ func (r *ReleaseTesting) Run(name string) error {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if r.Cleanup {
|
|
|
|
|
var manifestsToDelete strings.Builder
|
|
|
|
|
for _, h := range rel.Hooks {
|
|
|
|
|
for _, e := range h.Events {
|
|
|
|
|
if e == release.HookTest {
|
|
|
|
|
fmt.Fprintf(&manifestsToDelete, "\n---\n%s", h.Manifest)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
hooks, err := r.cfg.KubeClient.Build(bytes.NewBufferString(manifestsToDelete.String()), false)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("unable to build test hooks: %v", err)
|
|
|
|
|
}
|
|
|
|
|
if _, errs := r.cfg.KubeClient.Delete(hooks); errs != nil {
|
|
|
|
|
return fmt.Errorf("unable to delete test hooks: %v", joinErrors(errs))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return r.cfg.Releases.Update(rel)
|
|
|
|
|
}
|
|
|
|
|