@ -182,7 +182,7 @@ func TestInstallRelease(t *testing.T) {
req := require . New ( t )
req := require . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
ctx , done := context . WithCancel ( t . Context ( ) )
ctx , done := context . WithCancel ( t . Context ( ) )
resi , err := instAction . RunWithContext ( ctx , buildChart ( ) , vals )
resi , err := instAction . RunWithContext ( ctx , buildChart ( ) , vals )
if err != nil {
if err != nil {
@ -288,13 +288,13 @@ func TestInstallReleaseWithTakeOwnership_ResourceOwnedNoFlag(t *testing.T) {
func TestInstallReleaseWithValues ( t * testing . T ) {
func TestInstallReleaseWithValues ( t * testing . T ) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
userVals := map [ string ] interface { } {
userVals := map [ string ] any {
"nestedKey" : map [ string ] interface { } {
"nestedKey" : map [ string ] any {
"simpleKey" : "simpleValue" ,
"simpleKey" : "simpleValue" ,
} ,
} ,
}
}
expectedUserValues := map [ string ] interface { } {
expectedUserValues := map [ string ] any {
"nestedKey" : map [ string ] interface { } {
"nestedKey" : map [ string ] any {
"simpleKey" : "simpleValue" ,
"simpleKey" : "simpleValue" ,
} ,
} ,
}
}
@ -328,7 +328,7 @@ func TestInstallReleaseWithValues(t *testing.T) {
func TestInstallRelease_NoName ( t * testing . T ) {
func TestInstallRelease_NoName ( t * testing . T ) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = ""
instAction . ReleaseName = ""
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
_ , err := instAction . Run ( buildChart ( ) , vals )
_ , err := instAction . Run ( buildChart ( ) , vals )
if err == nil {
if err == nil {
t . Fatal ( "expected failure when no name is specified" )
t . Fatal ( "expected failure when no name is specified" )
@ -340,7 +340,7 @@ func TestInstallRelease_WithNotes(t *testing.T) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "with-notes"
instAction . ReleaseName = "with-notes"
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withNotes ( "note here" ) ) , vals )
resi , err := instAction . Run ( buildChart ( withNotes ( "note here" ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -371,7 +371,7 @@ func TestInstallRelease_WithNotesRendered(t *testing.T) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "with-notes"
instAction . ReleaseName = "with-notes"
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withNotes ( "got-{{.Release.Name}}" ) ) , vals )
resi , err := instAction . Run ( buildChart ( withNotes ( "got-{{.Release.Name}}" ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -384,7 +384,7 @@ func TestInstallRelease_WithNotesRendered(t *testing.T) {
rel , err := releaserToV1Release ( r )
rel , err := releaserToV1Release ( r )
is . NoError ( err )
is . NoError ( err )
expectedNotes := fmt . Sprintf ( "got-%s" , res . Name )
expectedNotes := "got-" + res . Name
is . Equal ( expectedNotes , rel . Info . Notes )
is . Equal ( expectedNotes , rel . Info . Notes )
is . Equal ( rel . Info . Description , "Install complete" )
is . Equal ( rel . Info . Description , "Install complete" )
}
}
@ -394,7 +394,7 @@ func TestInstallRelease_WithChartAndDependencyParentNotes(t *testing.T) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "with-notes"
instAction . ReleaseName = "with-notes"
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withNotes ( "parent" ) , withDependency ( withNotes ( "child" ) ) ) , vals )
resi , err := instAction . Run ( buildChart ( withNotes ( "parent" ) , withDependency ( withNotes ( "child" ) ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -417,7 +417,7 @@ func TestInstallRelease_WithChartAndDependencyAllNotes(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "with-notes"
instAction . ReleaseName = "with-notes"
instAction . SubNotes = true
instAction . SubNotes = true
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withNotes ( "parent" ) , withDependency ( withNotes ( "child" ) ) ) , vals )
resi , err := instAction . Run ( buildChart ( withNotes ( "parent" ) , withDependency ( withNotes ( "child" ) ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -443,7 +443,7 @@ func TestInstallRelease_DryRunClient(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . DryRunStrategy = dryRunStrategy
instAction . DryRunStrategy = dryRunStrategy
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withSampleTemplates ( ) ) , vals )
resi , err := instAction . Run ( buildChart ( withSampleTemplates ( ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -471,7 +471,7 @@ func TestInstallRelease_DryRunHiddenSecret(t *testing.T) {
// First perform a normal dry-run with the secret and confirm its presence.
// First perform a normal dry-run with the secret and confirm its presence.
instAction . DryRunStrategy = DryRunClient
instAction . DryRunStrategy = DryRunClient
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
resi , err := instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -486,7 +486,7 @@ func TestInstallRelease_DryRunHiddenSecret(t *testing.T) {
// Perform a dry-run where the secret should not be present
// Perform a dry-run where the secret should not be present
instAction . HideSecret = true
instAction . HideSecret = true
vals = map [ string ] interface { } { }
vals = map [ string ] any { }
res2i , err := instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
res2i , err := instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -502,10 +502,10 @@ func TestInstallRelease_DryRunHiddenSecret(t *testing.T) {
// Ensure there is an error when HideSecret True but not in a dry-run mode
// Ensure there is an error when HideSecret True but not in a dry-run mode
instAction . DryRunStrategy = DryRunNone
instAction . DryRunStrategy = DryRunNone
vals = map [ string ] interface { } { }
vals = map [ string ] any { }
_ , err = instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
_ , err = instAction . Run ( buildChart ( withSampleSecret ( ) , withSampleTemplates ( ) ) , vals )
if err == nil {
if err == nil {
t . Fatal f ( "Did not get expected an error when dry-run false and hide secret is true")
t . Fatal ( "Did not get the expected error when dry-run is false and hide secret is true")
}
}
}
}
@ -514,7 +514,7 @@ func TestInstallRelease_DryRun_Lookup(t *testing.T) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
instAction . DryRunStrategy = DryRunNone
instAction . DryRunStrategy = DryRunNone
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
mockChart := buildChart ( withSampleTemplates ( ) )
mockChart := buildChart ( withSampleTemplates ( ) )
mockChart . Templates = append ( mockChart . Templates , & common . File {
mockChart . Templates = append ( mockChart . Templates , & common . File {
@ -537,7 +537,7 @@ func TestInstallReleaseIncorrectTemplate_DryRun(t *testing.T) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
instAction . DryRunStrategy = DryRunNone
instAction . DryRunStrategy = DryRunNone
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
_ , err := instAction . Run ( buildChart ( withSampleIncludingIncorrectTemplates ( ) ) , vals )
_ , err := instAction . Run ( buildChart ( withSampleIncludingIncorrectTemplates ( ) ) , vals )
expectedErr := ` hello / templates / incorrect : 1 : 10
expectedErr := ` hello / templates / incorrect : 1 : 10
executing "hello/templates/incorrect" at < . Values . bad . doh > :
executing "hello/templates/incorrect" at < . Values . bad . doh > :
@ -555,7 +555,7 @@ func TestInstallRelease_NoHooks(t *testing.T) {
instAction . ReleaseName = "no-hooks"
instAction . ReleaseName = "no-hooks"
require . NoError ( t , instAction . cfg . Releases . Create ( releaseStub ( ) ) )
require . NoError ( t , instAction . cfg . Releases . Create ( releaseStub ( ) ) )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( ) , vals )
resi , err := instAction . Run ( buildChart ( ) , vals )
if err != nil {
if err != nil {
t . Fatalf ( "Failed install: %s" , err )
t . Fatalf ( "Failed install: %s" , err )
@ -571,12 +571,12 @@ func TestInstallRelease_FailedHooks(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "failed-hooks"
instAction . ReleaseName = "failed-hooks"
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer . WatchUntilReadyError = fmt. Errorf ( "Failed watch" )
failer . WatchUntilReadyError = errors. New ( "Failed watch" )
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
outBuffer := & bytes . Buffer { }
outBuffer := & bytes . Buffer { }
failer . PrintingKubeClient = kubefake . PrintingKubeClient { Out : io . Discard , LogOutput : outBuffer }
failer . PrintingKubeClient = kubefake . PrintingKubeClient { Out : io . Discard , LogOutput : outBuffer }
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( ) , vals )
resi , err := instAction . Run ( buildChart ( ) , vals )
is . Error ( err )
is . Error ( err )
res , err := releaserToV1Release ( resi )
res , err := releaserToV1Release ( resi )
@ -596,7 +596,7 @@ func TestInstallRelease_ReplaceRelease(t *testing.T) {
require . NoError ( t , instAction . cfg . Releases . Create ( rel ) )
require . NoError ( t , instAction . cfg . Releases . Create ( rel ) )
instAction . ReleaseName = rel . Name
instAction . ReleaseName = rel . Name
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( ) , vals )
resi , err := instAction . Run ( buildChart ( ) , vals )
is . NoError ( err )
is . NoError ( err )
res , err := releaserToV1Release ( resi )
res , err := releaserToV1Release ( resi )
@ -616,13 +616,13 @@ func TestInstallRelease_ReplaceRelease(t *testing.T) {
func TestInstallRelease_KubeVersion ( t * testing . T ) {
func TestInstallRelease_KubeVersion ( t * testing . T ) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
_ , err := instAction . Run ( buildChart ( withKube ( ">=0.0.0" ) ) , vals )
_ , err := instAction . Run ( buildChart ( withKube ( ">=0.0.0" ) ) , vals )
is . NoError ( err )
is . NoError ( err )
// This should fail for a few hundred years
// This should fail for a few hundred years
instAction . ReleaseName = "should-fail"
instAction . ReleaseName = "should-fail"
vals = map [ string ] interface { } { }
vals = map [ string ] any { }
_ , err = instAction . Run ( buildChart ( withKube ( ">=99.0.0" ) ) , vals )
_ , err = instAction . Run ( buildChart ( withKube ( ">=99.0.0" ) ) , vals )
is . Error ( err )
is . Error ( err )
is . Contains ( err . Error ( ) , "chart requires kubeVersion: >=99.0.0 which is incompatible with Kubernetes v1.20." )
is . Contains ( err . Error ( ) , "chart requires kubeVersion: >=99.0.0 which is incompatible with Kubernetes v1.20." )
@ -633,10 +633,10 @@ func TestInstallRelease_Wait(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "come-fail-away"
instAction . ReleaseName = "come-fail-away"
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer . WaitError = fmt. Errorf ( "I timed out" )
failer . WaitError = errors. New ( "I timed out" )
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . WaitStrategy = kube . StatusWatcherStrategy
instAction . WaitStrategy = kube . StatusWatcherStrategy
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
goroutines := instAction . getGoroutineCount ( )
goroutines := instAction . getGoroutineCount ( )
@ -657,7 +657,7 @@ func TestInstallRelease_Wait_Interrupted(t *testing.T) {
failer . WaitDuration = 10 * time . Second
failer . WaitDuration = 10 * time . Second
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . WaitStrategy = kube . StatusWatcherStrategy
instAction . WaitStrategy = kube . StatusWatcherStrategy
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
ctx , cancel := context . WithCancel ( t . Context ( ) )
ctx , cancel := context . WithCancel ( t . Context ( ) )
time . AfterFunc ( time . Second , cancel )
time . AfterFunc ( time . Second , cancel )
@ -677,11 +677,11 @@ func TestInstallRelease_WaitForJobs(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "come-fail-away"
instAction . ReleaseName = "come-fail-away"
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer . WaitError = fmt. Errorf ( "I timed out" )
failer . WaitError = errors. New ( "I timed out" )
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . WaitStrategy = kube . StatusWatcherStrategy
instAction . WaitStrategy = kube . StatusWatcherStrategy
instAction . WaitForJobs = true
instAction . WaitForJobs = true
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( ) , vals )
resi , err := instAction . Run ( buildChart ( ) , vals )
is . Error ( err )
is . Error ( err )
@ -698,13 +698,13 @@ func TestInstallRelease_RollbackOnFailure(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "come-fail-away"
instAction . ReleaseName = "come-fail-away"
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer . WaitError = fmt. Errorf ( "I timed out" )
failer . WaitError = errors. New ( "I timed out" )
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . RollbackOnFailure = true
instAction . RollbackOnFailure = true
// disabling hooks to avoid an early fail when
// disabling hooks to avoid an early fail when
// WaitForDelete is called on the pre-delete hook execution
// WaitForDelete is called on the pre-delete hook execution
instAction . DisableHooks = true
instAction . DisableHooks = true
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
resi , err := instAction . Run ( buildChart ( ) , vals )
resi , err := instAction . Run ( buildChart ( ) , vals )
is . Error ( err )
is . Error ( err )
@ -723,11 +723,11 @@ func TestInstallRelease_RollbackOnFailure(t *testing.T) {
instAction := installAction ( t )
instAction := installAction ( t )
instAction . ReleaseName = "come-fail-away-with-me"
instAction . ReleaseName = "come-fail-away-with-me"
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer . WaitError = fmt. Errorf ( "I timed out" )
failer . WaitError = errors. New ( "I timed out" )
failer . DeleteError = fmt. Errorf ( "uninstall fail" )
failer . DeleteError = errors. New ( "uninstall fail" )
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . RollbackOnFailure = true
instAction . RollbackOnFailure = true
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
_ , err := instAction . Run ( buildChart ( ) , vals )
_ , err := instAction . Run ( buildChart ( ) , vals )
is . Error ( err )
is . Error ( err )
@ -745,7 +745,7 @@ func TestInstallRelease_RollbackOnFailure_Interrupted(t *testing.T) {
failer . WaitDuration = 10 * time . Second
failer . WaitDuration = 10 * time . Second
instAction . cfg . KubeClient = failer
instAction . cfg . KubeClient = failer
instAction . RollbackOnFailure = true
instAction . RollbackOnFailure = true
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
ctx , cancel := context . WithCancel ( t . Context ( ) )
ctx , cancel := context . WithCancel ( t . Context ( ) )
time . AfterFunc ( time . Second , cancel )
time . AfterFunc ( time . Second , cancel )
@ -841,7 +841,7 @@ func TestNameTemplate(t *testing.T) {
func TestInstallReleaseOutputDir ( t * testing . T ) {
func TestInstallReleaseOutputDir ( t * testing . T ) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
dir := t . TempDir ( )
dir := t . TempDir ( )
@ -873,7 +873,7 @@ func TestInstallReleaseOutputDir(t *testing.T) {
func TestInstallOutputDirWithReleaseName ( t * testing . T ) {
func TestInstallOutputDirWithReleaseName ( t * testing . T ) {
is := assert . New ( t )
is := assert . New ( t )
instAction := installAction ( t )
instAction := installAction ( t )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
dir := t . TempDir ( )
dir := t . TempDir ( )
@ -1290,7 +1290,7 @@ func TestInstallRelease_WaitOptionsPassedDownstream(t *testing.T) {
// Access the underlying FailingKubeClient to check recorded options
// Access the underlying FailingKubeClient to check recorded options
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
failer := instAction . cfg . KubeClient . ( * kubefake . FailingKubeClient )
vals := map [ string ] interface { } { }
vals := map [ string ] any { }
_ , err := instAction . Run ( buildChart ( ) , vals )
_ , err := instAction . Run ( buildChart ( ) , vals )
is . NoError ( err )
is . NoError ( err )