From 0f15b01dfb87da35c068d4ddfc2e98511c5bfd53 Mon Sep 17 00:00:00 2001 From: Simon Alling Date: Fri, 10 Dec 2021 16:47:54 +0100 Subject: [PATCH] Remove runTestActionCmd and use runTestCmd instead `runTestCmd` is identical to `runTestActionCmd` except that it * runs the command multiple times if the `repeat` property is greater than zero, * calls its storage `storage` instead of `store`, * fails if the `Create` method returns an error, and * logs a "running cmd" message. This is most easily demonstrated by copying the functions to their own files and diffing the files with this command: git diff --no-index --ignore-space-change --color-words=. runTestActionCmd.go runTestCmd.go Also, `runTestCmd` is used 32 times; `runTestActionCmd` only 1. Signed-off-by: Simon Alling --- cmd/helm/helm_test.go | 21 --------------------- cmd/helm/install_test.go | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 5e59c41ed..2cf3e897d 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -71,27 +71,6 @@ func runTestCmd(t *testing.T, tests []cmdTestCase) { } } -func runTestActionCmd(t *testing.T, tests []cmdTestCase) { - t.Helper() - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - defer resetEnv()() - - store := storageFixture() - for _, rel := range tt.rels { - store.Create(rel) - } - _, out, err := executeActionCommandC(store, tt.cmd) - if (err != nil) != tt.wantError { - t.Errorf("expected error, got '%v'", err) - } - if tt.golden != "" { - test.AssertGoldenString(t, out, tt.golden) - } - }) - } -} - func storageFixture() *storage.Storage { return storage.Init(driver.NewMemory()) } diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index ff025b809..8c243b710 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -254,7 +254,7 @@ func TestInstall(t *testing.T) { }, } - runTestActionCmd(t, tests) + runTestCmd(t, tests) } func TestInstallOutputCompletion(t *testing.T) {