Skip to content

Commit

Permalink
fix test with t.Run()
Browse files Browse the repository at this point in the history
  • Loading branch information
koba1t committed Sep 12, 2022
1 parent cbb61fc commit 7c2e884
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions kustomize/commands/edit/fix/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,22 +369,22 @@ kind: Kustomization
},
}
for _, test := range tests {
fSys := filesys.MakeFsInMemory()
testutils_test.WriteTestKustomizationWith(fSys, []byte(test.input))
for filename, content := range test.files {
require.NoError(t, fSys.WriteFile(filename, []byte(content)))
}
cmd := NewCmdFix(fSys, os.Stdout)
require.NoError(t, cmd.RunE(cmd, nil))
t.Run(test.name, func(t *testing.T) {
fSys := filesys.MakeFsInMemory()
testutils_test.WriteTestKustomizationWith(fSys, []byte(test.input))
for filename, content := range test.files {
require.NoError(t, fSys.WriteFile(filename, []byte(content)))
}
cmd := NewCmdFix(fSys, os.Stdout)
require.NoError(t, cmd.RunE(cmd, nil))

content, err := testutils_test.ReadTestKustomization(fSys)
require.NoError(t, err)
require.Contains(t, string(content), "apiVersion: ")
require.Contains(t, string(content), "kind: Kustomization")
content, err := testutils_test.ReadTestKustomization(fSys)
require.NoError(t, err)
require.Contains(t, string(content), "apiVersion: ")
require.Contains(t, string(content), "kind: Kustomization")

if diff := cmp.Diff([]byte(test.expected), content); diff != "" {
t.Errorf("%s: Mismatch (-expected, +actual):\n%s", test.name, diff)
}
require.Empty(t, cmp.Diff([]byte(test.expected), content))
})
}
}

Expand Down

0 comments on commit 7c2e884

Please sign in to comment.