github.com/terraform-modules-krish/terratest@v0.29.0/modules/helm/rollback.go (about)

     1  package helm
     2  
     3  import (
     4  	"github.com/terraform-modules-krish/terratest/modules/testing"
     5  	"github.com/stretchr/testify/require"
     6  )
     7  
     8  // Rollback will downgrade the release to the specified version. This will fail
     9  // the test if there is an error.
    10  func Rollback(t testing.TestingT, options *Options, releaseName string, revision string) {
    11  	require.NoError(t, RollbackE(t, options, releaseName, revision))
    12  }
    13  
    14  // RollbackE will downgrade the release to the specified version
    15  func RollbackE(t testing.TestingT, options *Options, releaseName string, revision string) error {
    16  	var err error
    17  	args := []string{}
    18  	args = append(args, getNamespaceArgs(options)...)
    19  	args = append(args, releaseName)
    20  	if revision != "" {
    21  		args = append(args, revision)
    22  	}
    23  	_, err = RunHelmCommandAndGetOutputE(t, options, "rollback", args...)
    24  	return err
    25  }