New 🌊 wave for @helm

Commit 15a3e014

15a3e0146217Merged

Svyatoslav Dumchenko <[email protected]> · 4 years ago · 7 files · ~7 modified

Description

fix tests parallelization

Details

Commit
15a3e0146217
Parent
9c41ed735bc9

pkg/action/build_test.gomodifiedView file

@@ -113,14 +113,13 @@
113113
114114 ts.Require().ElementsMatch(c.names, names)
115115 }
116-
117116 }
118117
119-func (ts *BuildTestSuite) TestAutoYml() {
118+func (ts *BuildTestSuite) TestDiffLocal() {
120119 tmpDir := ts.T().TempDir()
121120 y := &Yml{
122- filepath.Join(tests.Root, "01_helmwave.yml.tpl"),
123- filepath.Join(tmpDir, "01_auto_yaml_helmwave.yml"),
121+ filepath.Join(tests.Root, "07_helmwave.yml"),
122+ filepath.Join(tests.Root, "07_helmwave.yml"),
124123 }
125124
126125 s := &Build{
@@ -129,21 +128,28 @@
129128 matchAll: true,
130129 autoYml: true,
131130 yml: y,
131+ diff: &Diff{},
132+ diffMode: diffModeLocal,
132133 }
133134
134- value := "test01"
135- ts.T().Setenv("PROJECT_NAME", value)
136- ts.T().Setenv("NAMESPACE", value)
135+ ts.Require().NoError(s.Run(), "build should not fail without diffing")
136+ ts.Require().NoError(s.Run(), "build should not fail with diffing with previous plan")
137+}
138+
139+func TestBuildTestSuite(t *testing.T) {
140+ t.Parallel()
141+ suite.Run(t, new(BuildTestSuite))
142+}
137143
138- ts.Require().NoError(s.Run())
139- ts.Require().DirExists(filepath.Join(s.plandir, plan.Manifest))
144+type NonParallelBuildTestSuite struct {
145+ suite.Suite
140146 }
141147
142-func (ts *BuildTestSuite) TestGomplate() {
148+func (ts *NonParallelBuildTestSuite) TestAutoYml() {
143149 tmpDir := ts.T().TempDir()
144150 y := &Yml{
145- filepath.Join(tests.Root, "08_helmwave.yml"),
146- filepath.Join(tmpDir, "08_helmwave.yml"),
151+ filepath.Join(tests.Root, "01_helmwave.yml.tpl"),
152+ filepath.Join(tmpDir, "01_auto_yaml_helmwave.yml"),
147153 }
148154
149155 s := &Build{
@@ -154,7 +160,7 @@
154160 yml: y,
155161 }
156162
157- value := "test08"
163+ value := "test01"
158164 ts.T().Setenv("PROJECT_NAME", value)
159165 ts.T().Setenv("NAMESPACE", value)
160166
@@ -162,11 +168,11 @@
162168 ts.Require().DirExists(filepath.Join(s.plandir, plan.Manifest))
163169 }
164170
165-func (ts *BuildTestSuite) TestDiffLocal() {
171+func (ts *NonParallelBuildTestSuite) TestGomplate() {
166172 tmpDir := ts.T().TempDir()
167173 y := &Yml{
168- filepath.Join(tests.Root, "07_helmwave.yml"),
169- filepath.Join(tests.Root, "07_helmwave.yml"),
174+ filepath.Join(tests.Root, "08_helmwave.yml"),
175+ filepath.Join(tmpDir, "08_helmwave.yml"),
170176 }
171177
172178 s := &Build{
@@ -175,15 +181,18 @@
175181 matchAll: true,
176182 autoYml: true,
177183 yml: y,
178- diff: &Diff{},
179- diffMode: diffModeLocal,
180184 }
181185
182- ts.Require().NoError(s.Run(), "build should not fail without diffing")
183- ts.Require().NoError(s.Run(), "build should not fail with diffing with previous plan")
186+ value := "test08"
187+ ts.T().Setenv("PROJECT_NAME", value)
188+ ts.T().Setenv("NAMESPACE", value)
189+
190+ ts.Require().NoError(s.Run())
191+ ts.Require().DirExists(filepath.Join(s.plandir, plan.Manifest))
184192 }
185193
186-func TestBuildTestSuite(t *testing.T) {
187- t.Parallel()
188- suite.Run(t, new(BuildTestSuite))
194+func TestNonParallelNonParallelBuildTestSuite(t *testing.T) {
195+ // cannot parallel because of setenv
196+ // t.Parallel()
197+ suite.Run(t, new(NonParallelBuildTestSuite))
189198 }