Commit 36f2d388
36f2d388e0c3Merged
Sviatoslav Dumchenko <[email protected]> · 2 years ago · 19 files · ~19 modified
Description
fix(tests): make mock errors traceable
Details
- Commit
- 36f2d388e0c3
- Parent
- ca2feb9f5d2c
pkg/hooks/run_test.gomodifiedView file
@@ -19,6 +19,15 @@
1919
mock.Mock2020
}2121
22+
func NewMockHook(t *testing.T) *MockHook {23+
t.Helper()24+
25+
c := &MockHook{}26+
c.Mock.Test(t)27+
28+
return c29+
}30+
2231
func (m *MockHook) Run(_ context.Context) error {2332
return m.Called().Error(0)2433
}@@ -43,7 +52,7 @@
4352
}4453
4554
func (ts *LifecycleRunTestSuite) TestRunNoError() {46-
hook := &MockHook{}55+
hook := NewMockHook(ts.T())4756
hook.On("Run").Return(nil)4857
4958
lifecycle := hooks.Lifecycle{PreBuild: []hooks.Hook{hook}}@@ -55,7 +64,7 @@
5564
}5665
5766
func (ts *LifecycleRunTestSuite) TestRunError() {58-
hook := &MockHook{}67+
hook := NewMockHook(ts.T())5968
errExpected := errors.New("test 123")6069
hook.On("Run").Return(errExpected)6170
hook.On("Log").Return(log.WithField("test", ts.T().Name()))pkg/plan/build_charts_internal_test.gomodifiedView file
Loading diff…
pkg/plan/build_manifests_internal_test.gomodifiedView file
Loading diff…
pkg/plan/build_registries_internal_test.gomodifiedView file
Loading diff…
pkg/plan/build_releases_internal_test.gomodifiedView file
Loading diff…
pkg/plan/build_repos_internal_test.gomodifiedView file
Loading diff…
pkg/plan/build_values_internal_test.gomodifiedView file
Loading diff…
pkg/plan/down_test.gomodifiedView file
Loading diff…
pkg/plan/export_internal_test.gomodifiedView file
Loading diff…
pkg/plan/kubedog_internal_test.gomodifiedView file
Loading diff…
pkg/plan/list_test.gomodifiedView file
Loading diff…
pkg/plan/mock_registry_export_test.gomodifiedView file
Loading diff…
pkg/plan/mock_release_export_test.gomodifiedView file
Loading diff…
pkg/plan/mock_repository_export_test.gomodifiedView file
Loading diff…
pkg/plan/new_test.gomodifiedView file
Loading diff…
pkg/plan/rollback_test.gomodifiedView file
Loading diff…
pkg/plan/status_test.gomodifiedView file
Loading diff…
pkg/plan/up_test.gomodifiedView file
Loading diff…
pkg/plan/validate_test.gomodifiedView file
Loading diff…