-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
rollback.go
29 lines (26 loc) · 904 Bytes
/
rollback.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package helm
import (
"github.com/gruntwork-io/terratest/modules/testing"
"github.com/stretchr/testify/require"
)
// Rollback will downgrade the release to the specified version. This will fail
// the test if there is an error.
func Rollback(t testing.TestingT, options *Options, releaseName string, revision string) {
require.NoError(t, RollbackE(t, options, releaseName, revision))
}
// RollbackE will downgrade the release to the specified version
func RollbackE(t testing.TestingT, options *Options, releaseName string, revision string) error {
var err error
args := []string{}
if options.ExtraArgs != nil {
if rollbackArgs, ok := options.ExtraArgs["rollback"]; ok {
args = append(args, rollbackArgs...)
}
}
args = append(args, releaseName)
if revision != "" {
args = append(args, revision)
}
_, err = RunHelmCommandAndGetOutputE(t, options, "rollback", args...)
return err
}