Repository: helm/helm
Pull request #12396 (2023-09-15 15:42:19)

Write latest version to get.helm.sh bucket
The purpose of this change is leverage this output for the get-helm script.

It will provide the following benefits:
- Use true semver so a future release of a patch version so a future release of a patch version does not cause an unexpected minor/major version downgrade

- Avoid reliance on the github api which has rate limiting. This will also increase availability by reducing the number of systems the get-helm script depends on.

- Simplify the script so parsing json is not necessary

- Increase uptime by only requiring the Azure CDN to be available

https://github.com/helm/helm/issues/12351


Patch:
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index c9702f2cd..970569e27 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -8,13 +8,11 @@ updates:
     groups:
       k8s.io:
         patterns:
-          - "k8s.io/api"
-          - "k8s.io/apiextensions-apiserver"
-          - "k8s.io/apimachinery"
-          - "k8s.io/apiserver"
-          - "k8s.io/cli-runtime"
-          - "k8s.io/client-go"
-          - "k8s.io/kubectl"
+          - "k8s.io/*"
+        exclude-patterns:
+          - "k8s.io/utils"
+          - "k8s.io/klog/v2"
+          - "k8s.io/kube-openapi"
   - package-ecosystem: "github-actions"
     directory: "/"
     schedule:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 055d0eaa0..05b4cfa45 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -19,6 +19,7 @@ jobs:
     steps:
       - name: Checkout source code
         uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3.6.0
+        fetch-depth: 0
 
       - name: Setup Go
         uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # pin@4.1.0
@@ -32,6 +33,10 @@ jobs:
         run: |
           make build-cross
           make dist checksum VERSION="${{ github.ref_name }}"
+      
+      - name: Set latest version
+          # Push the latest semver tag, excluding prerelease tags
+          git tag | sort -r --version-sort | grep '^v[0-9]' | grep -v '-' | head -n1 > _dist/helm-latest-version
 
       - name: Upload Binaries
         uses: bacongobbler/azure-blob-storage-upload@50f7d898b7697e864130ea04c303ca38b5751c50 # pin@3.0.0
diff --git a/cmd/helm/get.go b/cmd/helm/get.go
index 727cdaf88..7c4854b59 100644
--- a/cmd/helm/get.go
+++ b/cmd/helm/get.go
@@ -33,7 +33,6 @@ get extended information about the release, including:
 - The generated manifest file
 - The notes provided by the chart of the release
 - The hooks associated with the release
-- The metadata of the release
 `
 
 func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
@@ -49,7 +48,6 @@ func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 	cmd.AddCommand(newGetManifestCmd(cfg, out))
 	cmd.AddCommand(newGetHooksCmd(cfg, out))
 	cmd.AddCommand(newGetNotesCmd(cfg, out))
-	cmd.AddCommand(newGetMetadataCmd(cfg, out))
 
 	return cmd
 }
diff --git a/cmd/helm/get_all.go b/cmd/helm/get_all.go
index e51d50536..2dbef97cf 100644
--- a/cmd/helm/get_all.go
+++ b/cmd/helm/get_all.go
@@ -59,7 +59,7 @@ func newGetAllCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 				return tpl(template, data, out)
 			}
 
-			return output.Table.Write(out, &statusPrinter{res, true, false, false, true})
+			return output.Table.Write(out, &statusPrinter{res, true, false, false})
 		},
 	}
 
diff --git a/cmd/helm/get_metadata.go b/cmd/helm/get_metadata.go
deleted file mode 100644
index adab891bd..000000000
--- a/cmd/helm/get_metadata.go
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-Copyright The Helm Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package main
-
-import (
-	"fmt"
-	"io"
-	"log"
-
-	"github.com/spf13/cobra"
-
-	"helm.sh/helm/v3/cmd/helm/require"
-	"helm.sh/helm/v3/pkg/action"
-	"helm.sh/helm/v3/pkg/cli/output"
-)
-
-type metadataWriter struct {
-	metadata *action.Metadata
-}
-
-func newGetMetadataCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
-	var outfmt output.Format
-	client := action.NewGetMetadata(cfg)
-
-	cmd := &cobra.Command{
-		Use:   "metadata RELEASE_NAME",
-		Short: "This command fetches metadata for a given release",
-		Args:  require.ExactArgs(1),
-		ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
-			if len(args) != 0 {
-				return nil, cobra.ShellCompDirectiveNoFileComp
-			}
-			return compListReleases(toComplete, args, cfg)
-		},
-		RunE: func(cmd *cobra.Command, args []string) error {
-			releaseMetadata, err := client.Run(args[0])
-			if err != nil {
-				return err
-			}
-			return outfmt.Write(out, &metadataWriter{releaseMetadata})
-		},
-	}
-
-	f := cmd.Flags()
-	f.IntVar(&client.Version, "revision", 0, "specify release revision")
-	err := cmd.RegisterFlagCompletionFunc("revision", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
-		if len(args) == 1 {
-			return compListRevisions(toComplete, cfg, args[0])
-		}
-		return nil, cobra.ShellCompDirectiveNoFileComp
-	})
-
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	bindOutputFlag(cmd, &outfmt)
-
-	return cmd
-}
-
-func (w metadataWriter) WriteTable(out io.Writer) error {
-	_, _ = fmt.Fprintf(out, "NAME: %v\n", w.metadata.Name)
-	_, _ = fmt.Fprintf(out, "CHART: %v\n", w.metadata.Chart)
-	_, _ = fmt.Fprintf(out, "VERSION: %v\n", w.metadata.Version)
-	_, _ = fmt.Fprintf(out, "APP_VERSION: %v\n", w.metadata.AppVersion)
-	_, _ = fmt.Fprintf(out, "NAMESPACE: %v\n", w.metadata.Namespace)
-	_, _ = fmt.Fprintf(out, "REVISION: %v\n", w.metadata.Revision)
-	_, _ = fmt.Fprintf(out, "STATUS: %v\n", w.metadata.Status)
-	_, _ = fmt.Fprintf(out, "DEPLOYED_AT: %v\n", w.metadata.DeployedAt)
-	return nil
-}
-
-func (w metadataWriter) WriteJSON(out io.Writer) error {
-	return output.EncodeJSON(out, w.metadata)
-}
-
-func (w metadataWriter) WriteYAML(out io.Writer) error {
-	return output.EncodeYAML(out, w.metadata)
-}
diff --git a/cmd/helm/install.go b/cmd/helm/install.go
index d987d300f..ed949fdd7 100644
--- a/cmd/helm/install.go
+++ b/cmd/helm/install.go
@@ -154,7 +154,7 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 				return errors.Wrap(err, "INSTALLATION FAILED")
 			}
 
-			return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false, false})
+			return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false})
 		},
 	}
 
diff --git a/cmd/helm/repo_index.go b/cmd/helm/repo_index.go
index 3960380d1..917acd442 100644
--- a/cmd/helm/repo_index.go
+++ b/cmd/helm/repo_index.go
@@ -43,7 +43,6 @@ type repoIndexOptions struct {
 	dir   string
 	url   string
 	merge string
-	json  bool
 }
 
 func newRepoIndexCmd(out io.Writer) *cobra.Command {
@@ -71,7 +70,6 @@ func newRepoIndexCmd(out io.Writer) *cobra.Command {
 	f := cmd.Flags()
 	f.StringVar(&o.url, "url", "", "url of chart repository")
 	f.StringVar(&o.merge, "merge", "", "merge the generated index into the given index")
-	f.BoolVar(&o.json, "json", false, "output in JSON format")
 
 	return cmd
 }
@@ -82,10 +80,10 @@ func (i *repoIndexOptions) run(out io.Writer) error {
 		return err
 	}
 
-	return index(path, i.url, i.merge, i.json)
+	return index(path, i.url, i.merge)
 }
 
-func index(dir, url, mergeTo string, json bool) error {
+func index(dir, url, mergeTo string) error {
 	out := filepath.Join(dir, "index.yaml")
 
 	i, err := repo.IndexDirectory(dir, url)
@@ -97,7 +95,7 @@ func index(dir, url, mergeTo string, json bool) error {
 		var i2 *repo.IndexFile
 		if _, err := os.Stat(mergeTo); os.IsNotExist(err) {
 			i2 = repo.NewIndexFile()
-			writeIndexFile(i2, mergeTo, json)
+			i2.WriteFile(mergeTo, 0644)
 		} else {
 			i2, err = repo.LoadIndexFile(mergeTo)
 			if err != nil {
@@ -107,12 +105,5 @@ func index(dir, url, mergeTo string, json bool) error {
 		i.Merge(i2)
 	}
 	i.SortEntries()
-	return writeIndexFile(i, out, json)
-}
-
-func writeIndexFile(i *repo.IndexFile, out string, json bool) error {
-	if json {
-		return i.WriteJSONFile(out, 0644)
-	}
 	return i.WriteFile(out, 0644)
 }
diff --git a/cmd/helm/status.go b/cmd/helm/status.go
index 850862cd5..aa22aa02a 100644
--- a/cmd/helm/status.go
+++ b/cmd/helm/status.go
@@ -80,7 +80,7 @@ func newStatusCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 			// strip chart metadata from the output
 			rel.Chart = nil
 
-			return outfmt.Write(out, &statusPrinter{rel, false, client.ShowDescription, client.ShowResources, false})
+			return outfmt.Write(out, &statusPrinter{rel, false, client.ShowDescription, client.ShowResources})
 		},
 	}
 
@@ -112,7 +112,6 @@ type statusPrinter struct {
 	debug           bool
 	showDescription bool
 	showResources   bool
-	showMetadata    bool
 }
 
 func (s statusPrinter) WriteJSON(out io.Writer) error {
@@ -127,20 +126,15 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
 	if s.release == nil {
 		return nil
 	}
-	_, _ = fmt.Fprintf(out, "NAME: %s\n", s.release.Name)
+	fmt.Fprintf(out, "NAME: %s\n", s.release.Name)
 	if !s.release.Info.LastDeployed.IsZero() {
-		_, _ = fmt.Fprintf(out, "LAST DEPLOYED: %s\n", s.release.Info.LastDeployed.Format(time.ANSIC))
-	}
-	_, _ = fmt.Fprintf(out, "NAMESPACE: %s\n", s.release.Namespace)
-	_, _ = fmt.Fprintf(out, "STATUS: %s\n", s.release.Info.Status.String())
-	_, _ = fmt.Fprintf(out, "REVISION: %d\n", s.release.Version)
-	if s.showMetadata {
-		_, _ = fmt.Fprintf(out, "CHART: %s\n", s.release.Chart.Metadata.Name)
-		_, _ = fmt.Fprintf(out, "VERSION: %s\n", s.release.Chart.Metadata.Version)
-		_, _ = fmt.Fprintf(out, "APP_VERSION: %s\n", s.release.Chart.Metadata.AppVersion)
+		fmt.Fprintf(out, "LAST DEPLOYED: %s\n", s.release.Info.LastDeployed.Format(time.ANSIC))
 	}
+	fmt.Fprintf(out, "NAMESPACE: %s\n", s.release.Namespace)
+	fmt.Fprintf(out, "STATUS: %s\n", s.release.Info.Status.String())
+	fmt.Fprintf(out, "REVISION: %d\n", s.release.Version)
 	if s.showDescription {
-		_, _ = fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description)
+		fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description)
 	}
 
 	if s.showResources && s.release.Info.Resources != nil && len(s.release.Info.Resources) > 0 {
@@ -155,31 +149,31 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
 		}
 
 		for _, t := range keys {
-			_, _ = fmt.Fprintf(buf, "==> %s\n", t)
+			fmt.Fprintf(buf, "==> %s\n", t)
 
 			vk := s.release.Info.Resources[t]
 			for _, resource := range vk {
 				if err := printer.PrintObj(resource, buf); err != nil {
-					_, _ = fmt.Fprintf(buf, "failed to print object type %s: %v\n", t, err)
+					fmt.Fprintf(buf, "failed to print object type %s: %v\n", t, err)
 				}
 			}
 
 			buf.WriteString("\n")
 		}
 
-		_, _ = fmt.Fprintf(out, "RESOURCES:\n%s\n", buf.String())
+		fmt.Fprintf(out, "RESOURCES:\n%s\n", buf.String())
 	}
 
 	executions := executionsByHookEvent(s.release)
 	if tests, ok := executions[release.HookTest]; !ok || len(tests) == 0 {
-		_, _ = fmt.Fprintln(out, "TEST SUITE: None")
+		fmt.Fprintln(out, "TEST SUITE: None")
 	} else {
 		for _, h := range tests {
 			// Don't print anything if hook has not been initiated
 			if h.LastRun.StartedAt.IsZero() {
 				continue
 			}
-			_, _ = fmt.Fprintf(out, "TEST SUITE:     %s\n%s\n%s\n%s\n",
+			fmt.Fprintf(out, "TEST SUITE:     %s\n%s\n%s\n%s\n",
 				h.Name,
 				fmt.Sprintf("Last Started:   %s", h.LastRun.StartedAt.Format(time.ANSIC)),
 				fmt.Sprintf("Last Completed: %s", h.LastRun.CompletedAt.Format(time.ANSIC)),
@@ -189,38 +183,38 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
 	}
 
 	if s.debug {
-		_, _ = fmt.Fprintln(out, "USER-SUPPLIED VALUES:")
+		fmt.Fprintln(out, "USER-SUPPLIED VALUES:")
 		err := output.EncodeYAML(out, s.release.Config)
 		if err != nil {
 			return err
 		}
 		// Print an extra newline
-		_, _ = fmt.Fprintln(out)
+		fmt.Fprintln(out)
 
 		cfg, err := chartutil.CoalesceValues(s.release.Chart, s.release.Config)
 		if err != nil {
 			return err
 		}
 
-		_, _ = fmt.Fprintln(out, "COMPUTED VALUES:")
+		fmt.Fprintln(out, "COMPUTED VALUES:")
 		err = output.EncodeYAML(out, cfg.AsMap())
 		if err != nil {
 			return err
 		}
 		// Print an extra newline
-		_, _ = fmt.Fprintln(out)
+		fmt.Fprintln(out)
 	}
 
 	if strings.EqualFold(s.release.Info.Description, "Dry run complete") || s.debug {
-		_, _ = fmt.Fprintln(out, "HOOKS:")
+		fmt.Fprintln(out, "HOOKS:")
 		for _, h := range s.release.Hooks {
-			_, _ = fmt.Fprintf(out, "---\n# Source: %s\n%s\n", h.Path, h.Manifest)
+			fmt.Fprintf(out, "---\n# Source: %s\n%s\n", h.Path, h.Manifest)
 		}
-		_, _ = fmt.Fprintf(out, "MANIFEST:\n%s\n", s.release.Manifest)
+		fmt.Fprintf(out, "MANIFEST:\n%s\n", s.release.Manifest)
 	}
 
 	if len(s.release.Info.Notes) > 0 {
-		_, _ = fmt.Fprintf(out, "NOTES:\n%s\n", strings.TrimSpace(s.release.Info.Notes))
+		fmt.Fprintf(out, "NOTES:\n%s\n", strings.TrimSpace(s.release.Info.Notes))
 	}
 	return nil
 }
diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go
index 328497d7e..886f40292 100644
--- a/cmd/helm/upgrade.go
+++ b/cmd/helm/upgrade.go
@@ -147,7 +147,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 					if err != nil {
 						return err
 					}
-					return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false, false})
+					return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false})
 				} else if err != nil {
 					return err
 				}
@@ -233,7 +233,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 				fmt.Fprintf(out, "Release %q has been upgraded. Happy Helming!\n", args[0])
 			}
 
-			return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false, false})
+			return outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false})
 		},
 	}
 
diff --git a/go.mod b/go.mod
index d7928b24b..f2549557d 100644
--- a/go.mod
+++ b/go.mod
@@ -11,7 +11,7 @@ require (
 	github.com/Masterminds/vcs v1.13.3
 	github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
 	github.com/containerd/containerd v1.7.3
-	github.com/cyphar/filepath-securejoin v0.2.4
+	github.com/cyphar/filepath-securejoin v0.2.3
 	github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2
 	github.com/evanphx/json-patch v5.6.0+incompatible
 	github.com/foxcpp/go-mockdns v1.0.0
diff --git a/go.sum b/go.sum
index 12f5426e7..b2a44ba46 100644
--- a/go.sum
+++ b/go.sum
@@ -99,8 +99,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
 github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
 github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
-github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
-github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
+github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
+github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/pkg/action/get_metadata.go b/pkg/action/get_metadata.go
deleted file mode 100644
index ec096ae16..000000000
--- a/pkg/action/get_metadata.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Copyright The Helm Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package action
-
-import "time"
-
-// GetMetadata is the action for checking a given release's metadata.
-//
-// It provides the implementation of 'helm get metadata'.
-type GetMetadata struct {
-	cfg *Configuration
-
-	Version int
-}
-
-type Metadata struct {
-	Name       string `json:"name" yaml:"name"`
-	Chart      string `json:"chart" yaml:"chart"`
-	Version    string `json:"version" yaml:"version"`
-	AppVersion string `json:"appVersion" yaml:"appVersion"`
-	Namespace  string `json:"namespace" yaml:"namespace"`
-	Revision   int    `json:"revision" yaml:"revision"`
-	Status     string `json:"status" yaml:"status"`
-	DeployedAt string `json:"deployedAt" yaml:"deployedAt"`
-}
-
-// NewGetMetadata creates a new GetMetadata object with the given configuration.
-func NewGetMetadata(cfg *Configuration) *GetMetadata {
-	return &GetMetadata{
-		cfg: cfg,
-	}
-}
-
-// Run executes 'helm get metadata' against the given release.
-func (g *GetMetadata) Run(name string) (*Metadata, error) {
-	if err := g.cfg.KubeClient.IsReachable(); err != nil {
-		return nil, err
-	}
-
-	rel, err := g.cfg.releaseContent(name, g.Version)
-	if err != nil {
-		return nil, err
-	}
-
-	return &Metadata{
-		Name:       rel.Name,
-		Chart:      rel.Chart.Metadata.Name,
-		Version:    rel.Chart.Metadata.Version,
-		AppVersion: rel.Chart.Metadata.AppVersion,
-		Namespace:  rel.Namespace,
-		Revision:   rel.Version,
-		Status:     rel.Info.Status.String(),
-		DeployedAt: rel.Info.LastDeployed.Format(time.RFC3339),
-	}, nil
-}
diff --git a/pkg/repo/index.go b/pkg/repo/index.go
index 8a23ba060..ba2e365c8 100644
--- a/pkg/repo/index.go
+++ b/pkg/repo/index.go
@@ -18,7 +18,6 @@ package repo
 
 import (
 	"bytes"
-	"encoding/json"
 	"log"
 	"os"
 	"path"
@@ -233,18 +232,6 @@ func (i IndexFile) WriteFile(dest string, mode os.FileMode) error {
 	return fileutil.AtomicWriteFile(dest, bytes.NewReader(b), mode)
 }
 
-// WriteJSONFile writes an index file in JSON format to the given destination
-// path.
-//
-// The mode on the file is set to 'mode'.
-func (i IndexFile) WriteJSONFile(dest string, mode os.FileMode) error {
-	b, err := json.MarshalIndent(i, "", "  ")
-	if err != nil {
-		return err
-	}
-	return fileutil.AtomicWriteFile(dest, bytes.NewReader(b), mode)
-}
-
 // Merge merges the given index file into this index.
 //
 // This merges by name and version.
@@ -349,7 +336,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) {
 		return i, ErrEmptyIndexYaml
 	}
 
-	if err := jsonOrYamlUnmarshal(data, i); err != nil {
+	if err := yaml.UnmarshalStrict(data, i); err != nil {
 		return i, err
 	}
 
@@ -374,17 +361,3 @@ func loadIndex(data []byte, source string) (*IndexFile, error) {
 	}
 	return i, nil
 }
-
-// jsonOrYamlUnmarshal unmarshals the given byte slice containing JSON or YAML
-// into the provided interface.
-//
-// It automatically detects whether the data is in JSON or YAML format by
-// checking its validity as JSON. If the data is valid JSON, it will use the
-// `encoding/json` package to unmarshal it. Otherwise, it will use the
-// `sigs.k8s.io/yaml` package to unmarshal the YAML data.
-func jsonOrYamlUnmarshal(b []byte, i interface{}) error {
-	if json.Valid(b) {
-		return json.Unmarshal(b, i)
-	}
-	return yaml.UnmarshalStrict(b, i)
-}
diff --git a/pkg/storage/driver/sql.go b/pkg/storage/driver/sql.go
index 892f10bbb..18f51f3fd 100644
--- a/pkg/storage/driver/sql.go
+++ b/pkg/storage/driver/sql.go
@@ -94,42 +94,8 @@ func (s *SQL) Name() string {
 	return SQLDriverName
 }
 
-// Check if all migrations al
-func (s *SQL) checkAlreadyApplied(migrations []*migrate.Migration) bool {
-	// make map (set) of ids for fast search
-	migrationsIds := make(map[string]struct{})
-	for _, migration := range migrations {
-		migrationsIds[migration.Id] = struct{}{}
-	}
-
-	// get list of applied migrations
-	migrate.SetDisableCreateTable(true)
-	records, err := migrate.GetMigrationRecords(s.db.DB, postgreSQLDialect)
-	migrate.SetDisableCreateTable(false)
-	if err != nil {
-		s.Log("checkAlreadyApplied: failed to get migration records: %v", err)
-		return false
-	}
-
-	for _, record := range records {
-		if _, ok := migrationsIds[record.Id]; ok {
-			s.Log("checkAlreadyApplied: found previous migration (Id: %v) applied at %v", record.Id, record.AppliedAt)
-			delete(migrationsIds, record.Id)
-		}
-	}
-
-	// check if all migrations appliyed
-	if len(migrationsIds) != 0 {
-		for id := range migrationsIds {
-			s.Log("checkAlreadyApplied: find unapplied migration (id: %v)", id)
-		}
-		return false
-	}
-	return true
-}
-
 func (s *SQL) ensureDBSetup() error {
-
+	// Populate the database with the relations we need if they don't exist yet
 	migrations := &migrate.MemoryMigrationSource{
 		Migrations: []*migrate.Migration{
 			{
@@ -155,9 +121,9 @@ func (s *SQL) ensureDBSetup() error {
 						CREATE INDEX ON %s (%s);
 						CREATE INDEX ON %s (%s);
 						CREATE INDEX ON %s (%s);
-	
+						
 						GRANT ALL ON %s TO PUBLIC;
-	
+
 						ALTER TABLE %s ENABLE ROW LEVEL SECURITY;
 					`,
 						sqlReleaseTableName,
@@ -234,12 +200,6 @@ func (s *SQL) ensureDBSetup() error {
 		},
 	}
 
-	// Check that init migration already applied
-	if s.checkAlreadyApplied(migrations.Migrations) {
-		return nil
-	}
-
-	// Populate the database with the relations we need if they don't exist yet
 	_, err := migrate.Exec(s.db.DB, postgreSQLDialect, migrations, migrate.Up)
 	return err
 }


Test patch:
diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go
index 1a22d058f..4a3e0b33d 100644
--- a/cmd/helm/create_test.go
+++ b/cmd/helm/create_test.go
@@ -30,9 +30,9 @@ import (
 )
 
 func TestCreateCmd(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 	cname := "testchart"
-	dir := t.TempDir()
+	dir := ensure.TempDir(t)
 	defer testChdir(t, dir)()
 
 	// Run a create
@@ -61,7 +61,7 @@ func TestCreateCmd(t *testing.T) {
 }
 
 func TestCreateStarterCmd(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 	cname := "testchart"
 	defer resetEnv()()
 	os.MkdirAll(helmpath.CachePath(), 0755)
@@ -127,7 +127,7 @@ func TestCreateStarterCmd(t *testing.T) {
 
 func TestCreateStarterAbsoluteCmd(t *testing.T) {
 	defer resetEnv()()
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 	cname := "testchart"
 
 	// Create a starter.
diff --git a/cmd/helm/dependency_update_test.go b/cmd/helm/dependency_update_test.go
index b94bb7819..491f6a856 100644
--- a/cmd/helm/dependency_update_test.go
+++ b/cmd/helm/dependency_update_test.go
@@ -149,7 +149,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
 
 func TestDependencyUpdateCmd_DoNotDeleteOldChartsOnError(t *testing.T) {
 	defer resetEnv()()
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	srv, err := repotest.NewTempServerWithCleanup(t, "testdata/testcharts/*.tgz")
 	if err != nil {
diff --git a/cmd/helm/get_metadata_test.go b/cmd/helm/get_metadata_test.go
deleted file mode 100644
index b6f0ab9f2..000000000
--- a/cmd/helm/get_metadata_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-Copyright The Helm Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package main
-
-import (
-	"testing"
-
-	"helm.sh/helm/v3/pkg/release"
-)
-
-func TestGetMetadataCmd(t *testing.T) {
-	tests := []cmdTestCase{{
-		name:   "get metadata with a release",
-		cmd:    "get metadata thomas-guide",
-		golden: "output/get-metadata.txt",
-		rels:   []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "thomas-guide"})},
-	}, {
-		name:      "get metadata requires release name arg",
-		cmd:       "get metadata",
-		golden:    "output/get-metadata-args.txt",
-		rels:      []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "thomas-guide"})},
-		wantError: true,
-	}, {
-		name:   "get metadata to json",
-		cmd:    "get metadata thomas-guide --output json",
-		golden: "output/get-metadata.json",
-		rels:   []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "thomas-guide"})},
-	}, {
-		name:   "get metadata to yaml",
-		cmd:    "get metadata thomas-guide --output yaml",
-		golden: "output/get-metadata.yaml",
-		rels:   []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "thomas-guide"})},
-	}}
-	runTestCmd(t, tests)
-}
-
-func TestGetMetadataCompletion(t *testing.T) {
-	checkReleaseCompletion(t, "get metadata", false)
-}
-
-func TestGetMetadataRevisionCompletion(t *testing.T) {
-	revisionFlagCompletionTest(t, "get metadata")
-}
-
-func TestGetMetadataOutputCompletion(t *testing.T) {
-	outputFlagCompletionTest(t, "get metadata")
-}
-
-func TestGetMetadataFileCompletion(t *testing.T) {
-	checkFileCompletion(t, "get metadata", false)
-	checkFileCompletion(t, "get metadata myrelease", false)
-}
diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go
index 9093b510c..d7e01fb75 100644
--- a/cmd/helm/package_test.go
+++ b/cmd/helm/package_test.go
@@ -23,6 +23,7 @@ import (
 	"strings"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chart/loader"
 )
@@ -110,7 +111,7 @@ func TestPackage(t *testing.T) {
 
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			cachePath := t.TempDir()
+			cachePath := ensure.TempDir(t)
 			defer testChdir(t, cachePath)()
 
 			if err := os.MkdirAll("toot", 0777); err != nil {
@@ -169,7 +170,7 @@ func TestSetAppVersion(t *testing.T) {
 	var ch *chart.Chart
 	expectedAppVersion := "app-version-foo"
 	chartToPackage := "testdata/testcharts/alpine"
-	dir := t.TempDir()
+	dir := ensure.TempDir(t)
 	cmd := fmt.Sprintf("package %s --destination=%s --app-version=%s", chartToPackage, dir, expectedAppVersion)
 	_, output, err := executeActionCommand(cmd)
 	if err != nil {
diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go
index 548ae2b8a..668d30206 100644
--- a/cmd/helm/release_testing.go
+++ b/cmd/helm/release_testing.go
@@ -72,7 +72,7 @@ func newReleaseTestCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
 				return runErr
 			}
 
-			if err := outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false, false}); err != nil {
+			if err := outfmt.Write(out, &statusPrinter{rel, settings.Debug, false, false}); err != nil {
 				return err
 			}
 
diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go
index 2386bb01f..9475f056b 100644
--- a/cmd/helm/repo_add_test.go
+++ b/cmd/helm/repo_add_test.go
@@ -27,6 +27,7 @@ import (
 
 	"sigs.k8s.io/yaml"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/helmpath"
 	"helm.sh/helm/v3/pkg/helmpath/xdg"
 	"helm.sh/helm/v3/pkg/repo"
@@ -47,7 +48,7 @@ func TestRepoAddCmd(t *testing.T) {
 	}
 	defer srv2.Stop()
 
-	tmpdir := filepath.Join(t.TempDir(), "path-component.yaml/data")
+	tmpdir := filepath.Join(ensure.TempDir(t), "path-component.yaml/data")
 	err = os.MkdirAll(tmpdir, 0777)
 	if err != nil {
 		t.Fatal(err)
@@ -87,7 +88,7 @@ func TestRepoAdd(t *testing.T) {
 	}
 	defer ts.Stop()
 
-	rootDir := t.TempDir()
+	rootDir := ensure.TempDir(t)
 	repoFile := filepath.Join(rootDir, "repositories.yaml")
 
 	const testRepoName = "test-name"
@@ -144,8 +145,8 @@ func TestRepoAddCheckLegalName(t *testing.T) {
 
 	const testRepoName = "test-hub/test-name"
 
-	rootDir := t.TempDir()
-	repoFile := filepath.Join(t.TempDir(), "repositories.yaml")
+	rootDir := ensure.TempDir(t)
+	repoFile := filepath.Join(ensure.TempDir(t), "repositories.yaml")
 
 	o := &repoAddOptions{
 		name:               testRepoName,
@@ -169,25 +170,25 @@ func TestRepoAddCheckLegalName(t *testing.T) {
 
 func TestRepoAddConcurrentGoRoutines(t *testing.T) {
 	const testName = "test-name"
-	repoFile := filepath.Join(t.TempDir(), "repositories.yaml")
+	repoFile := filepath.Join(ensure.TempDir(t), "repositories.yaml")
 	repoAddConcurrent(t, testName, repoFile)
 }
 
 func TestRepoAddConcurrentDirNotExist(t *testing.T) {
 	const testName = "test-name-2"
-	repoFile := filepath.Join(t.TempDir(), "foo", "repositories.yaml")
+	repoFile := filepath.Join(ensure.TempDir(t), "foo", "repositories.yaml")
 	repoAddConcurrent(t, testName, repoFile)
 }
 
 func TestRepoAddConcurrentNoFileExtension(t *testing.T) {
 	const testName = "test-name-3"
-	repoFile := filepath.Join(t.TempDir(), "repositories")
+	repoFile := filepath.Join(ensure.TempDir(t), "repositories")
 	repoAddConcurrent(t, testName, repoFile)
 }
 
 func TestRepoAddConcurrentHiddenFile(t *testing.T) {
 	const testName = "test-name-4"
-	repoFile := filepath.Join(t.TempDir(), ".repositories")
+	repoFile := filepath.Join(ensure.TempDir(t), ".repositories")
 	repoAddConcurrent(t, testName, repoFile)
 }
 
@@ -253,7 +254,7 @@ func TestRepoAddWithPasswordFromStdin(t *testing.T) {
 		t.Errorf("unexpected error, got '%v'", err)
 	}
 
-	tmpdir := t.TempDir()
+	tmpdir := ensure.TempDir(t)
 	repoFile := filepath.Join(tmpdir, "repositories.yaml")
 
 	store := storageFixture()
diff --git a/cmd/helm/repo_index_test.go b/cmd/helm/repo_index_test.go
index 554a3dadf..ae3390154 100644
--- a/cmd/helm/repo_index_test.go
+++ b/cmd/helm/repo_index_test.go
@@ -18,18 +18,18 @@ package main
 
 import (
 	"bytes"
-	"encoding/json"
 	"io"
 	"os"
 	"path/filepath"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/repo"
 )
 
 func TestRepoIndexCmd(t *testing.T) {
 
-	dir := t.TempDir()
+	dir := ensure.TempDir(t)
 
 	comp := filepath.Join(dir, "compressedchart-0.1.0.tgz")
 	if err := linkOrCopy("testdata/testcharts/compressedchart-0.1.0.tgz", comp); err != nil {
@@ -68,28 +68,6 @@ func TestRepoIndexCmd(t *testing.T) {
 		t.Errorf("expected %q, got %q", expectedVersion, vs[0].Version)
 	}
 
-	b, err := os.ReadFile(destIndex)
-	if err != nil {
-		t.Fatal(err)
-	}
-	if json.Valid(b) {
-		t.Error("did not expect index file to be valid json")
-	}
-
-	// Test with `--json`
-
-	c.ParseFlags([]string{"--json", "true"})
-	if err := c.RunE(c, []string{dir}); err != nil {
-		t.Error(err)
-	}
-
-	if b, err = os.ReadFile(destIndex); err != nil {
-		t.Fatal(err)
-	}
-	if !json.Valid(b) {
-		t.Error("index file is not valid json")
-	}
-
 	// Test with `--merge`
 
 	// Remove first two charts.
diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go
index e2795e738..768295655 100644
--- a/cmd/helm/repo_remove_test.go
+++ b/cmd/helm/repo_remove_test.go
@@ -24,6 +24,7 @@ import (
 	"strings"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/helmpath"
 	"helm.sh/helm/v3/pkg/repo"
 	"helm.sh/helm/v3/pkg/repo/repotest"
@@ -36,7 +37,7 @@ func TestRepoRemove(t *testing.T) {
 	}
 	defer ts.Stop()
 
-	rootDir := t.TempDir()
+	rootDir := ensure.TempDir(t)
 	repoFile := filepath.Join(rootDir, "repositories.yaml")
 
 	const testRepoName = "test-name"
@@ -168,7 +169,7 @@ func TestRepoRemoveCompletion(t *testing.T) {
 	}
 	defer ts.Stop()
 
-	rootDir := t.TempDir()
+	rootDir := ensure.TempDir(t)
 	repoFile := filepath.Join(rootDir, "repositories.yaml")
 	repoCache := filepath.Join(rootDir, "cache/")
 
diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go
index 645c68cfe..a6fbc1b0d 100644
--- a/cmd/helm/repo_update_test.go
+++ b/cmd/helm/repo_update_test.go
@@ -102,9 +102,10 @@ func TestUpdateCmdInvalid(t *testing.T) {
 }
 
 func TestUpdateCustomCacheCmd(t *testing.T) {
-	rootDir := t.TempDir()
+	rootDir := ensure.TempDir(t)
 	cachePath := filepath.Join(rootDir, "updcustomcache")
 	os.Mkdir(cachePath, os.ModePerm)
+	defer os.RemoveAll(cachePath)
 
 	ts, err := repotest.NewTempServerWithCleanup(t, "testdata/testserver/*.*")
 	if err != nil {
@@ -128,7 +129,7 @@ func TestUpdateCustomCacheCmd(t *testing.T) {
 
 func TestUpdateCharts(t *testing.T) {
 	defer resetEnv()()
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	ts, err := repotest.NewTempServerWithCleanup(t, "testdata/testserver/*.*")
 	if err != nil {
@@ -163,7 +164,7 @@ func TestRepoUpdateFileCompletion(t *testing.T) {
 
 func TestUpdateChartsFail(t *testing.T) {
 	defer resetEnv()()
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	ts, err := repotest.NewTempServerWithCleanup(t, "testdata/testserver/*.*")
 	if err != nil {
@@ -196,7 +197,7 @@ func TestUpdateChartsFail(t *testing.T) {
 
 func TestUpdateChartsFailWithError(t *testing.T) {
 	defer resetEnv()()
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	ts, err := repotest.NewTempServerWithCleanup(t, "testdata/testserver/*.*")
 	if err != nil {
diff --git a/cmd/helm/root_test.go b/cmd/helm/root_test.go
index 65e6d66c7..075544971 100644
--- a/cmd/helm/root_test.go
+++ b/cmd/helm/root_test.go
@@ -77,7 +77,7 @@ func TestRootCmd(t *testing.T) {
 
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			ensure.HelmHome(t)
+			defer ensure.HelmHome(t)()
 
 			for k, v := range tt.envvars {
 				os.Setenv(k, v)
diff --git a/cmd/helm/status_test.go b/cmd/helm/status_test.go
index 6722bf949..6d34d6db7 100644
--- a/cmd/helm/status_test.go
+++ b/cmd/helm/status_test.go
@@ -32,7 +32,7 @@ func TestStatusCmd(t *testing.T) {
 			Name:      "flummoxed-chickadee",
 			Namespace: "default",
 			Info:      info,
-			Chart:     &chart.Chart{Metadata: &chart.Metadata{Name: "name", Version: "1.2.3", AppVersion: "3.2.1"}},
+			Chart:     &chart.Chart{},
 			Hooks:     hooks,
 		}}
 	}
diff --git a/cmd/helm/testdata/output/get-metadata-args.txt b/cmd/helm/testdata/output/get-metadata-args.txt
deleted file mode 100644
index acd3f4c15..000000000
--- a/cmd/helm/testdata/output/get-metadata-args.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Error: "helm get metadata" requires 1 argument
-
-Usage:  helm get metadata RELEASE_NAME [flags]
diff --git a/cmd/helm/testdata/output/get-metadata.json b/cmd/helm/testdata/output/get-metadata.json
deleted file mode 100644
index 1d5152b24..000000000
--- a/cmd/helm/testdata/output/get-metadata.json
+++ /dev/null
@@ -1,1 +0,0 @@
-{"name":"thomas-guide","chart":"foo","version":"0.1.0-beta.1","appVersion":"1.0","namespace":"default","revision":1,"status":"deployed","deployedAt":"1977-09-02T22:04:05Z"}
diff --git a/cmd/helm/testdata/output/get-metadata.txt b/cmd/helm/testdata/output/get-metadata.txt
deleted file mode 100644
index b91f1b86a..000000000
--- a/cmd/helm/testdata/output/get-metadata.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-NAME: thomas-guide
-CHART: foo
-VERSION: 0.1.0-beta.1
-APP_VERSION: 1.0
-NAMESPACE: default
-REVISION: 1
-STATUS: deployed
-DEPLOYED_AT: 1977-09-02T22:04:05Z
diff --git a/cmd/helm/testdata/output/get-metadata.yaml b/cmd/helm/testdata/output/get-metadata.yaml
deleted file mode 100644
index b6d49b038..000000000
--- a/cmd/helm/testdata/output/get-metadata.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-appVersion: "1.0"
-chart: foo
-deployedAt: "1977-09-02T22:04:05Z"
-name: thomas-guide
-namespace: default
-revision: 1
-status: deployed
-version: 0.1.0-beta.1
diff --git a/cmd/helm/testdata/output/get-release.txt b/cmd/helm/testdata/output/get-release.txt
index 12b4a407a..f6c3b57eb 100644
--- a/cmd/helm/testdata/output/get-release.txt
+++ b/cmd/helm/testdata/output/get-release.txt
@@ -3,9 +3,6 @@ LAST DEPLOYED: Fri Sep  2 22:04:05 1977
 NAMESPACE: default
 STATUS: deployed
 REVISION: 1
-CHART: foo
-VERSION: 0.1.0-beta.1
-APP_VERSION: 1.0
 TEST SUITE: None
 USER-SUPPLIED VALUES:
 name: value
diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go
index 485267d1d..0e2e291f7 100644
--- a/cmd/helm/upgrade_test.go
+++ b/cmd/helm/upgrade_test.go
@@ -24,6 +24,7 @@ import (
 	"strings"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chart/loader"
 	"helm.sh/helm/v3/pkg/chartutil"
@@ -32,7 +33,7 @@ import (
 
 func TestUpgradeCmd(t *testing.T) {
 
-	tmpChart := t.TempDir()
+	tmpChart := ensure.TempDir(t)
 	cfile := &chart.Chart{
 		Metadata: &chart.Metadata{
 			APIVersion:  chart.APIVersionV1,
@@ -357,7 +358,7 @@ func TestUpgradeInstallWithValuesFromStdin(t *testing.T) {
 }
 
 func prepareMockRelease(releaseName string, t *testing.T) (func(n string, v int, ch *chart.Chart) *release.Release, *chart.Chart, string) {
-	tmpChart := t.TempDir()
+	tmpChart := ensure.TempDir(t)
 	configmapData, err := os.ReadFile("testdata/testcharts/upgradetest/templates/configmap.yaml")
 	if err != nil {
 		t.Fatalf("Error loading template yaml %v", err)
diff --git a/internal/test/ensure/ensure.go b/internal/test/ensure/ensure.go
index ff2d180fe..49c3cf1ef 100644
--- a/internal/test/ensure/ensure.go
+++ b/internal/test/ensure/ensure.go
@@ -26,27 +26,41 @@ import (
 )
 
 // HelmHome sets up a Helm Home in a temp dir.
-func HelmHome(t *testing.T) {
+func HelmHome(t *testing.T) func() {
 	t.Helper()
-	base := t.TempDir()
+	base := TempDir(t)
 	os.Setenv(xdg.CacheHomeEnvVar, base)
 	os.Setenv(xdg.ConfigHomeEnvVar, base)
 	os.Setenv(xdg.DataHomeEnvVar, base)
 	os.Setenv(helmpath.CacheHomeEnvVar, "")
 	os.Setenv(helmpath.ConfigHomeEnvVar, "")
 	os.Setenv(helmpath.DataHomeEnvVar, "")
+	return func() {
+		os.RemoveAll(base)
+	}
+}
+
+// TempDir ensures a scratch test directory for unit testing purposes.
+func TempDir(t *testing.T) string {
+	t.Helper()
+	d, err := os.MkdirTemp("", "helm")
+	if err != nil {
+		t.Fatal(err)
+	}
+	return d
 }
 
 // TempFile ensures a temp file for unit testing purposes.
 //
 // It returns the path to the directory (to which you will still need to join the filename)
 //
-// The returned directory is automatically removed when the test and all its subtests complete.
+// You must clean up the directory that is returned.
 //
 //	tempdir := TempFile(t, "foo", []byte("bar"))
+//	defer os.RemoveAll(tempdir)
 //	filename := filepath.Join(tempdir, "foo")
 func TempFile(t *testing.T, name string, data []byte) string {
-	path := t.TempDir()
+	path := TempDir(t)
 	filename := filepath.Join(path, name)
 	if err := os.WriteFile(filename, data, 0755); err != nil {
 		t.Fatal(err)
diff --git a/pkg/action/package_test.go b/pkg/action/package_test.go
index d04efdaa6..0b62e7f8c 100644
--- a/pkg/action/package_test.go
+++ b/pkg/action/package_test.go
@@ -29,6 +29,7 @@ import (
 func TestPassphraseFileFetcher(t *testing.T) {
 	secret := "secret"
 	directory := ensure.TempFile(t, "passphrase-file", []byte(secret))
+	defer os.RemoveAll(directory)
 
 	fetcher, err := passphraseFileFetcher(path.Join(directory, "passphrase-file"), nil)
 	if err != nil {
@@ -48,6 +49,7 @@ func TestPassphraseFileFetcher(t *testing.T) {
 func TestPassphraseFileFetcher_WithLineBreak(t *testing.T) {
 	secret := "secret"
 	directory := ensure.TempFile(t, "passphrase-file", []byte(secret+"\n\n."))
+	defer os.RemoveAll(directory)
 
 	fetcher, err := passphraseFileFetcher(path.Join(directory, "passphrase-file"), nil)
 	if err != nil {
@@ -65,7 +67,8 @@ func TestPassphraseFileFetcher_WithLineBreak(t *testing.T) {
 }
 
 func TestPassphraseFileFetcher_WithInvalidStdin(t *testing.T) {
-	directory := t.TempDir()
+	directory := ensure.TempDir(t)
+	defer os.RemoveAll(directory)
 
 	stdin, err := os.CreateTemp(directory, "non-existing")
 	if err != nil {
diff --git a/pkg/chartutil/save_test.go b/pkg/chartutil/save_test.go
index db485c7cb..b7f5c2ac0 100644
--- a/pkg/chartutil/save_test.go
+++ b/pkg/chartutil/save_test.go
@@ -29,12 +29,14 @@ import (
 	"testing"
 	"time"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chart/loader"
 )
 
 func TestSave(t *testing.T) {
-	tmp := t.TempDir()
+	tmp := ensure.TempDir(t)
+	defer os.RemoveAll(tmp)
 
 	for _, dest := range []string{tmp, filepath.Join(tmp, "newdir")} {
 		t.Run("outDir="+dest, func(t *testing.T) {
diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go
index 131e21306..8ff780daf 100644
--- a/pkg/downloader/chart_downloader_test.go
+++ b/pkg/downloader/chart_downloader_test.go
@@ -269,9 +269,10 @@ func TestDownloadTo_TLS(t *testing.T) {
 }
 
 func TestDownloadTo_VerifyLater(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
-	dest := t.TempDir()
+	dest := ensure.TempDir(t)
+	defer os.RemoveAll(dest)
 
 	// Set up a fake repo
 	srv, err := repotest.NewTempServerWithCleanup(t, "testdata/*.tgz*")
diff --git a/pkg/lint/rules/dependencies_test.go b/pkg/lint/rules/dependencies_test.go
index 24c5faf7f..67b160936 100644
--- a/pkg/lint/rules/dependencies_test.go
+++ b/pkg/lint/rules/dependencies_test.go
@@ -16,9 +16,11 @@ limitations under the License.
 package rules
 
 import (
+	"os"
 	"path/filepath"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chartutil"
 	"helm.sh/helm/v3/pkg/lint/support"
@@ -77,7 +79,8 @@ func TestValidateDependencyInMetadata(t *testing.T) {
 }
 
 func TestDependencies(t *testing.T) {
-	tmp := t.TempDir()
+	tmp := ensure.TempDir(t)
+	defer os.RemoveAll(tmp)
 
 	c := chartWithBadDependencies()
 	err := chartutil.SaveDir(&c, tmp)
diff --git a/pkg/lint/rules/template_test.go b/pkg/lint/rules/template_test.go
index 80f9b28ed..f3aa641f2 100644
--- a/pkg/lint/rules/template_test.go
+++ b/pkg/lint/rules/template_test.go
@@ -23,6 +23,7 @@ import (
 	"strings"
 	"testing"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/chartutil"
 	"helm.sh/helm/v3/pkg/lint/support"
@@ -220,7 +221,8 @@ func TestDeprecatedAPIFails(t *testing.T) {
 			},
 		},
 	}
-	tmpdir := t.TempDir()
+	tmpdir := ensure.TempDir(t)
+	defer os.RemoveAll(tmpdir)
 
 	if err := chartutil.SaveDir(&mychart, tmpdir); err != nil {
 		t.Fatal(err)
@@ -276,7 +278,8 @@ func TestStrictTemplateParsingMapError(t *testing.T) {
 			},
 		},
 	}
-	dir := t.TempDir()
+	dir := ensure.TempDir(t)
+	defer os.RemoveAll(dir)
 	if err := chartutil.SaveDir(&ch, dir); err != nil {
 		t.Fatal(err)
 	}
@@ -405,7 +408,8 @@ func TestEmptyWithCommentsManifests(t *testing.T) {
 			},
 		},
 	}
-	tmpdir := t.TempDir()
+	tmpdir := ensure.TempDir(t)
+	defer os.RemoveAll(tmpdir)
 
 	if err := chartutil.SaveDir(&mychart, tmpdir); err != nil {
 		t.Fatal(err)
diff --git a/pkg/lint/rules/values_test.go b/pkg/lint/rules/values_test.go
index faa29d48a..21eb875f4 100644
--- a/pkg/lint/rules/values_test.go
+++ b/pkg/lint/rules/values_test.go
@@ -66,6 +66,7 @@ func TestValidateValuesFileWellFormed(t *testing.T) {
 	not:well[]{}formed
 	`
 	tmpdir := ensure.TempFile(t, "values.yaml", []byte(badYaml))
+	defer os.RemoveAll(tmpdir)
 	valfile := filepath.Join(tmpdir, "values.yaml")
 	if err := validateValuesFile(valfile, map[string]interface{}{}); err == nil {
 		t.Fatal("expected values file to fail parsing")
@@ -75,6 +76,7 @@ func TestValidateValuesFileWellFormed(t *testing.T) {
 func TestValidateValuesFileSchema(t *testing.T) {
 	yaml := "username: admin\npassword: swordfish"
 	tmpdir := ensure.TempFile(t, "values.yaml", []byte(yaml))
+	defer os.RemoveAll(tmpdir)
 	createTestingSchema(t, tmpdir)
 
 	valfile := filepath.Join(tmpdir, "values.yaml")
@@ -87,6 +89,7 @@ func TestValidateValuesFileSchemaFailure(t *testing.T) {
 	// 1234 is an int, not a string. This should fail.
 	yaml := "username: 1234\npassword: swordfish"
 	tmpdir := ensure.TempFile(t, "values.yaml", []byte(yaml))
+	defer os.RemoveAll(tmpdir)
 	createTestingSchema(t, tmpdir)
 
 	valfile := filepath.Join(tmpdir, "values.yaml")
@@ -105,6 +108,7 @@ func TestValidateValuesFileSchemaOverrides(t *testing.T) {
 		"password": "swordfish",
 	}
 	tmpdir := ensure.TempFile(t, "values.yaml", []byte(yaml))
+	defer os.RemoveAll(tmpdir)
 	createTestingSchema(t, tmpdir)
 
 	valfile := filepath.Join(tmpdir, "values.yaml")
@@ -141,6 +145,7 @@ func TestValidateValuesFile(t *testing.T) {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 			tmpdir := ensure.TempFile(t, "values.yaml", []byte(tt.yaml))
+			defer os.RemoveAll(tmpdir)
 			createTestingSchema(t, tmpdir)
 
 			valfile := filepath.Join(tmpdir, "values.yaml")
diff --git a/pkg/plugin/installer/http_installer_test.go b/pkg/plugin/installer/http_installer_test.go
index 177227c5b..165007af0 100644
--- a/pkg/plugin/installer/http_installer_test.go
+++ b/pkg/plugin/installer/http_installer_test.go
@@ -79,7 +79,7 @@ func mockArchiveServer() *httptest.Server {
 }
 
 func TestHTTPInstaller(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	srv := mockArchiveServer()
 	defer srv.Close()
@@ -128,7 +128,7 @@ func TestHTTPInstaller(t *testing.T) {
 }
 
 func TestHTTPInstallerNonExistentVersion(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 	srv := mockArchiveServer()
 	defer srv.Close()
 	source := srv.URL + "/plugins/fake-plugin-0.0.1.tar.gz"
@@ -164,7 +164,7 @@ func TestHTTPInstallerUpdate(t *testing.T) {
 	srv := mockArchiveServer()
 	defer srv.Close()
 	source := srv.URL + "/plugins/fake-plugin-0.0.1.tar.gz"
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	if err := os.MkdirAll(helmpath.DataPath("plugins"), 0755); err != nil {
 		t.Fatalf("Could not create %s: %s", helmpath.DataPath("plugins"), err)
diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go
index 0bb0b6780..6785264b3 100644
--- a/pkg/plugin/installer/vcs_installer_test.go
+++ b/pkg/plugin/installer/vcs_installer_test.go
@@ -49,7 +49,7 @@ func (r *testRepo) UpdateVersion(version string) error {
 }
 
 func TestVCSInstaller(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	if err := os.MkdirAll(helmpath.DataPath("plugins"), 0755); err != nil {
 		t.Fatalf("Could not create %s: %s", helmpath.DataPath("plugins"), err)
@@ -102,7 +102,7 @@ func TestVCSInstaller(t *testing.T) {
 }
 
 func TestVCSInstallerNonExistentVersion(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	source := "https://github.com/adamreese/helm-env"
 	version := "0.2.0"
@@ -124,7 +124,7 @@ func TestVCSInstallerNonExistentVersion(t *testing.T) {
 	}
 }
 func TestVCSInstallerUpdate(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	source := "https://github.com/adamreese/helm-env"
 
diff --git a/pkg/postrender/exec_test.go b/pkg/postrender/exec_test.go
index 19a6ec6c4..471acf112 100644
--- a/pkg/postrender/exec_test.go
+++ b/pkg/postrender/exec_test.go
@@ -25,6 +25,8 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
+
+	"helm.sh/helm/v3/internal/test/ensure"
 )
 
 const testingScript = `#!/bin/sh
@@ -38,7 +40,8 @@ fi
 func TestGetFullPath(t *testing.T) {
 	is := assert.New(t)
 	t.Run("full path resolves correctly", func(t *testing.T) {
-		testpath := setupTestingScript(t)
+		testpath, cleanup := setupTestingScript(t)
+		defer cleanup()
 
 		fullPath, err := getFullPath(testpath)
 		is.NoError(err)
@@ -46,7 +49,8 @@ func TestGetFullPath(t *testing.T) {
 	})
 
 	t.Run("relative path resolves correctly", func(t *testing.T) {
-		testpath := setupTestingScript(t)
+		testpath, cleanup := setupTestingScript(t)
+		defer cleanup()
 
 		currentDir, err := os.Getwd()
 		require.NoError(t, err)
@@ -58,7 +62,8 @@ func TestGetFullPath(t *testing.T) {
 	})
 
 	t.Run("binary in PATH resolves correctly", func(t *testing.T) {
-		testpath := setupTestingScript(t)
+		testpath, cleanup := setupTestingScript(t)
+		defer cleanup()
 
 		realPath := os.Getenv("PATH")
 		os.Setenv("PATH", filepath.Dir(testpath))
@@ -111,7 +116,8 @@ func TestExecRun(t *testing.T) {
 		t.Skip("skipping on windows")
 	}
 	is := assert.New(t)
-	testpath := setupTestingScript(t)
+	testpath, cleanup := setupTestingScript(t)
+	defer cleanup()
 
 	renderer, err := NewExec(testpath)
 	require.NoError(t, err)
@@ -127,7 +133,8 @@ func TestNewExecWithOneArgsRun(t *testing.T) {
 		t.Skip("skipping on windows")
 	}
 	is := assert.New(t)
-	testpath := setupTestingScript(t)
+	testpath, cleanup := setupTestingScript(t)
+	defer cleanup()
 
 	renderer, err := NewExec(testpath, "ARG1")
 	require.NoError(t, err)
@@ -143,7 +150,8 @@ func TestNewExecWithTwoArgsRun(t *testing.T) {
 		t.Skip("skipping on windows")
 	}
 	is := assert.New(t)
-	testpath := setupTestingScript(t)
+	testpath, cleanup := setupTestingScript(t)
+	defer cleanup()
 
 	renderer, err := NewExec(testpath, "ARG1", "ARG2")
 	require.NoError(t, err)
@@ -153,10 +161,10 @@ func TestNewExecWithTwoArgsRun(t *testing.T) {
 	is.Contains(output.String(), "ARG1 ARG2")
 }
 
-func setupTestingScript(t *testing.T) (filepath string) {
+func setupTestingScript(t *testing.T) (filepath string, cleanup func()) {
 	t.Helper()
 
-	tempdir := t.TempDir()
+	tempdir := ensure.TempDir(t)
 
 	f, err := os.CreateTemp(tempdir, "post-render-test.sh")
 	if err != nil {
@@ -178,5 +186,7 @@ func setupTestingScript(t *testing.T) (filepath string) {
 		t.Fatalf("unable to close tempfile after writing: %s", err)
 	}
 
-	return f.Name()
+	return f.Name(), func() {
+		os.RemoveAll(tempdir)
+	}
 }
diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go
index 4d4395c2d..b32834220 100644
--- a/pkg/repo/chartrepo_test.go
+++ b/pkg/repo/chartrepo_test.go
@@ -30,6 +30,7 @@ import (
 
 	"sigs.k8s.io/yaml"
 
+	"helm.sh/helm/v3/internal/test/ensure"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/cli"
 	"helm.sh/helm/v3/pkg/getter"
@@ -146,7 +147,8 @@ func TestIndexCustomSchemeDownload(t *testing.T) {
 	if err != nil {
 		t.Fatalf("Problem loading chart repository from %s: %v", repoURL, err)
 	}
-	repo.CachePath = t.TempDir()
+	repo.CachePath = ensure.TempDir(t)
+	defer os.RemoveAll(repo.CachePath)
 
 	tempIndexFile, err := os.CreateTemp("", "test-repo")
 	if err != nil {
@@ -347,7 +349,7 @@ func TestFindChartInRepoURL(t *testing.T) {
 func TestErrorFindChartInRepoURL(t *testing.T) {
 
 	g := getter.All(&cli.EnvSettings{
-		RepositoryCache: t.TempDir(),
+		RepositoryCache: ensure.TempDir(t),
 	})
 
 	if _, err := FindChartInRepoURL("http://someserver/something", "nginx", "", "", "", "", g); err == nil {
diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go
index efb50ba6a..bbc48c97e 100644
--- a/pkg/repo/index_test.go
+++ b/pkg/repo/index_test.go
@@ -19,7 +19,6 @@ package repo
 import (
 	"bufio"
 	"bytes"
-	"encoding/json"
 	"net/http"
 	"os"
 	"path/filepath"
@@ -38,7 +37,6 @@ const (
 	annotationstestfile = "testdata/local-index-annotations.yaml"
 	chartmuseumtestfile = "testdata/chartmuseum-index.yaml"
 	unorderedTestfile   = "testdata/local-index-unordered.yaml"
-	jsonTestfile        = "testdata/local-index.json"
 	testRepo            = "test-repo"
 	indexWithDuplicates = `
 apiVersion: v1
@@ -147,10 +145,6 @@ func TestLoadIndex(t *testing.T) {
 			Name:     "chartmuseum index file",
 			Filename: chartmuseumtestfile,
 		},
-		{
-			Name:     "JSON index file",
-			Filename: jsonTestfile,
-		},
 	}
 
 	for _, tc := range tests {
@@ -554,27 +548,6 @@ func TestIndexWrite(t *testing.T) {
 	}
 }
 
-func TestIndexJSONWrite(t *testing.T) {
-	i := NewIndexFile()
-	if err := i.MustAdd(&chart.Metadata{APIVersion: "v2", Name: "clipper", Version: "0.1.0"}, "clipper-0.1.0.tgz", "http://example.com/charts", "sha256:1234567890"); err != nil {
-		t.Fatalf("unexpected error: %s", err)
-	}
-	dir := t.TempDir()
-	testpath := filepath.Join(dir, "test")
-	i.WriteJSONFile(testpath, 0600)
-
-	got, err := os.ReadFile(testpath)
-	if err != nil {
-		t.Fatal(err)
-	}
-	if !json.Valid(got) {
-		t.Fatal("Index files doesn't contain valid JSON")
-	}
-	if !strings.Contains(string(got), "clipper-0.1.0.tgz") {
-		t.Fatal("Index files doesn't contain expected content")
-	}
-}
-
 func TestAddFileIndexEntriesNil(t *testing.T) {
 	i := NewIndexFile()
 	i.APIVersion = chart.APIVersionV1
diff --git a/pkg/repo/repotest/server_test.go b/pkg/repo/repotest/server_test.go
index a7d7f5b95..d16552897 100644
--- a/pkg/repo/repotest/server_test.go
+++ b/pkg/repo/repotest/server_test.go
@@ -18,6 +18,7 @@ package repotest
 import (
 	"io"
 	"net/http"
+	"os"
 	"path/filepath"
 	"testing"
 
@@ -30,9 +31,10 @@ import (
 // Young'n, in these here parts, we test our tests.
 
 func TestServer(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
-	rootDir := t.TempDir()
+	rootDir := ensure.TempDir(t)
+	defer os.RemoveAll(rootDir)
 
 	srv := NewServer(rootDir)
 	defer srv.Stop()
@@ -97,7 +99,7 @@ func TestServer(t *testing.T) {
 }
 
 func TestNewTempServer(t *testing.T) {
-	ensure.HelmHome(t)
+	defer ensure.HelmHome(t)()
 
 	srv, err := NewTempServerWithCleanup(t, "testdata/examplechart-0.1.0.tgz")
 	if err != nil {
diff --git a/pkg/repo/testdata/local-index.json b/pkg/repo/testdata/local-index.json
deleted file mode 100644
index 25296d5ca..000000000
--- a/pkg/repo/testdata/local-index.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-  "apiVersion": "v1",
-  "entries": {
-    "nginx": [
-      {
-        "urls": ["https://charts.helm.sh/stable/nginx-0.2.0.tgz"],
-        "name": "nginx",
-        "description": "string",
-        "version": "0.2.0",
-        "home": "https://github.com/something/else",
-        "digest": "sha256:1234567890abcdef",
-        "keywords": ["popular", "web server", "proxy"],
-        "apiVersion": "v2"
-      },
-      {
-        "urls": ["https://charts.helm.sh/stable/nginx-0.1.0.tgz"],
-        "name": "nginx",
-        "description": "string",
-        "version": "0.1.0",
-        "home": "https://github.com/something",
-        "digest": "sha256:1234567890abcdef",
-        "keywords": ["popular", "web server", "proxy"],
-        "apiVersion": "v2"
-      }
-    ],
-    "alpine": [
-      {
-        "urls": [
-          "https://charts.helm.sh/stable/alpine-1.0.0.tgz",
-          "http://storage2.googleapis.com/kubernetes-charts/alpine-1.0.0.tgz"
-        ],
-        "name": "alpine",
-        "description": "string",
-        "version": "1.0.0",
-        "home": "https://github.com/something",
-        "keywords": ["linux", "alpine", "small", "sumtin"],
-        "digest": "sha256:1234567890abcdef",
-        "apiVersion": "v2"
-      }
-    ],
-    "chartWithNoURL": [
-      {
-        "name": "chartWithNoURL",
-        "description": "string",
-        "version": "1.0.0",
-        "home": "https://github.com/something",
-        "keywords": ["small", "sumtin"],
-        "digest": "sha256:1234567890abcdef",
-        "apiVersion": "v2"
-      }
-    ]
-  }
-}
diff --git a/pkg/storage/driver/sql_test.go b/pkg/storage/driver/sql_test.go
index 067b3cf47..4c0c7b668 100644
--- a/pkg/storage/driver/sql_test.go
+++ b/pkg/storage/driver/sql_test.go
@@ -21,7 +21,6 @@ import (
 	"time"
 
 	sqlmock "github.com/DATA-DOG/go-sqlmock"
-	migrate "github.com/rubenv/sql-migrate"
 
 	rspb "helm.sh/helm/v3/pkg/release"
 )
@@ -531,51 +530,3 @@ func mockGetReleaseCustomLabels(mock sqlmock.Sqlmock, key string, namespace stri
 	}
 	eq.WillReturnRows(returnRows).RowsWillBeClosed()
 }
-
-func TestSqlChechkAppliedMigrations(t *testing.T) {
-	cases := []struct {
-		migrationsToApply    []*migrate.Migration
-		appliedMigrationsIds []string
-		expectedResult       bool
-		errorExplanation     string
-	}{
-		{
-			migrationsToApply:    []*migrate.Migration{{Id: "init1"}, {Id: "init2"}, {Id: "init3"}},
-			appliedMigrationsIds: []string{"1", "2", "init1", "3", "init2", "4", "5"},
-			expectedResult:       false,
-			errorExplanation:     "Has found one migration id \"init3\" as applied, that was not applied",
-		},
-		{
-			migrationsToApply:    []*migrate.Migration{{Id: "init1"}, {Id: "init2"}, {Id: "init3"}},
-			appliedMigrationsIds: []string{"1", "2", "init1", "3", "init2", "4", "init3", "5"},
-			expectedResult:       true,
-			errorExplanation:     "Has not found one or more migration ids, that was applied",
-		},
-		{
-			migrationsToApply:    []*migrate.Migration{{Id: "init"}},
-			appliedMigrationsIds: []string{"1", "2", "3", "inits", "4", "tinit", "5"},
-			expectedResult:       false,
-			errorExplanation:     "Has found single \"init\", that was not applied",
-		},
-		{
-			migrationsToApply:    []*migrate.Migration{{Id: "init"}},
-			appliedMigrationsIds: []string{"1", "2", "init", "3", "init2", "4", "init3", "5"},
-			expectedResult:       true,
-			errorExplanation:     "Has not found single migration id \"init\", that was applied",
-		},
-	}
-	for i, c := range cases {
-		sqlDriver, mock := newTestFixtureSQL(t)
-		rows := sqlmock.NewRows([]string{"id", "applied_at"})
-		for _, id := range c.appliedMigrationsIds {
-			rows.AddRow(id, time.Time{})
-		}
-		mock.
-			ExpectQuery("").
-			WillReturnRows(rows)
-		mock.ExpectCommit()
-		if sqlDriver.checkAlreadyApplied(c.migrationsToApply) != c.expectedResult {
-			t.Errorf("Test case: %v, Expected: %v, Have: %v, Explanation: %v", i, c.expectedResult, !c.expectedResult, c.errorExplanation)
-		}
-	}
-}