New 🌊 wave for @helm

Commit 69ae7ad8

69ae7ad8e90eMerged

Sviatoslav Dumchenko <[email protected]> · 3 years ago · 14 files · +4 added · ~9 modified · -1 deleted

Description

chore(tests): refactor some tests

Details

Commit
69ae7ad8e90e
Parent
fede47d18234

pkg/action/build_internal_test.gomodifiedView file

@@ -20,6 +20,59 @@
2020 suite.Suite
2121 }
2222
23+func TestBuildTestSuite(t *testing.T) {
24+ t.Parallel()
25+ suite.Run(t, new(BuildTestSuite))
26+}
27+
28+func (ts *BuildTestSuite) TestCmd() {
29+ s := &Build{}
30+ cmd := s.Cmd()
31+
32+ ts.Require().NotNil(cmd)
33+ ts.Require().NotEmpty(cmd.Name)
34+}
35+
36+func (ts *BuildTestSuite) TestYmlError() {
37+ tmpDir := ts.T().TempDir()
38+ y := &Yml{
39+ file: filepath.Join(tests.Root, "helmwave.yml"),
40+ templater: template.TemplaterSprig,
41+ }
42+
43+ s := &Build{
44+ plandir: tmpDir,
45+ yml: y,
46+ tags: cli.StringSlice{},
47+ options: plan.BuildOptions{
48+ MatchAll: true,
49+ },
50+ }
51+
52+ ts.Require().Error(s.Run(context.Background()))
53+}
54+
55+func (ts *BuildTestSuite) TestInvalidCacheDir() {
56+ tmpDir := ts.T().TempDir()
57+ y := &Yml{
58+ tpl: filepath.Join(tests.Root, "01_helmwave.yml.tpl"),
59+ file: filepath.Join(tests.Root, "02_helmwave.yml"),
60+ templater: template.TemplaterSprig,
61+ }
62+
63+ s := &Build{
64+ plandir: tmpDir,
65+ yml: y,
66+ tags: cli.StringSlice{},
67+ options: plan.BuildOptions{
68+ MatchAll: true,
69+ },
70+ chartsCacheDir: "/proc/1/bla",
71+ }
72+
73+ ts.Require().Error(s.Run(context.Background()))
74+}
75+
2376 func (ts *BuildTestSuite) TestManifest() {
2477 tmpDir := ts.T().TempDir()
2578 y := &Yml{
@@ -153,15 +206,16 @@
153206 ts.Require().NoError(s.Run(context.Background()), "build should not fail with diffing with previous plan")
154207 }
155208
156-func TestBuildTestSuite(t *testing.T) {
157- t.Parallel()
158- suite.Run(t, new(BuildTestSuite))
159-}
160-
161209 type NonParallelBuildTestSuite struct {
162210 suite.Suite
163211 }
164212
213+//nolintlint:paralleltest // can't parallel because of setenv and uses helm repository.yaml flock
214+func TestNonParallelNonParallelBuildTestSuite(t *testing.T) {
215+ // t.Parallel()
216+ suite.Run(t, new(NonParallelBuildTestSuite))
217+}
218+
165219 func (ts *NonParallelBuildTestSuite) TestAutoYml() {
166220 tmpDir := ts.T().TempDir()
167221 y := &Yml{
@@ -240,10 +294,4 @@
240294 ts.Require().Contains(output, "run global pre_build script")
241295 ts.Require().Contains(output, "running post_build script for nginx")
242296 ts.Require().Contains(output, "run global post_build script")
243-}
244-
245-//nolintlint:paralleltest // can't parallel because of setenv and uses helm repository.yaml flock
246-func TestNonParallelNonParallelBuildTestSuite(t *testing.T) {
247- // t.Parallel()
248- suite.Run(t, new(NonParallelBuildTestSuite))
249297 }