From 0c7d67e071642123bdabb88b4eb84100ea232861 Mon Sep 17 00:00:00 2001 From: Chris Kim Date: Mon, 6 Apr 2020 13:25:01 -0700 Subject: [PATCH] Split into two tests --- cmd/krew/cmd/namingutils_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/krew/cmd/namingutils_test.go b/cmd/krew/cmd/namingutils_test.go index e1b41c51..2f17211d 100644 --- a/cmd/krew/cmd/namingutils_test.go +++ b/cmd/krew/cmd/namingutils_test.go @@ -134,11 +134,17 @@ func Test_allIndexes(t *testing.T) { if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("got diffent output: %s", diff) } +} +func Test_allIndexes_withMultiIndex(t *testing.T) { os.Setenv(constants.EnableMultiIndexSwitch, "1") defer os.Unsetenv(constants.EnableMultiIndexSwitch) - expected = []indexoperations.Index{ + tmpDir, cleanup := testutil.NewTempDir(t) + defer cleanup() + paths := environment.NewPaths(tmpDir.Root()) + + expected := []indexoperations.Index{ { Name: "custom", URL: "https://github.com/custom/index.git", @@ -154,7 +160,7 @@ func Test_allIndexes(t *testing.T) { tmpDir.InitEmptyGitRepo(path, index.URL) } - actual, err = allIndexes(paths) + actual, err := allIndexes(paths) if err != nil { t.Errorf("unexpected error getting indexes: %s", err) }