Skip to content

Refactor tests under services package#14221

Merged
russjones merged 3 commits intomasterfrom
rjones/refactor-services
Jul 8, 2022
Merged

Refactor tests under services package#14221
russjones merged 3 commits intomasterfrom
rjones/refactor-services

Conversation

@russjones
Copy link
Copy Markdown
Contributor

@russjones russjones commented Jul 8, 2022

Refactored all tests under lib/services/suite to use testify instead of gocheck.


Used the following gofmt rewrite rules to automate most of the refactoring.

gofmt -r 'c.Assert(a, check.NotNil) -> require.NotNil(t, a)' -w *_test.go   
gofmt -r 'c.Assert(a, check.NotNil, b) -> require.NotNilf(t, a, b)' -w *_test.go   
gofmt -r 'c.Assert(a, check.FitsTypeOf, b) -> require.IsTypef(t, a, b)' -w *_test.go   
gofmt -r 'c.Assert(a, check.IsNil) -> require.NoError(t, a)' -w *_test.go   
gofmt -r 'c.Assert(a, check.IsNil, d) -> require.NoError(t, a, d)' -w *_test.go   
gofmt -r 'c.Assert(a, check.Equals, b) -> require.Equal(t, a, b)' -w *_test.go
gofmt -r 'c.Assert(a, check.HasLen, b) -> require.Len(t, a, b)' -w *_test.go
gofmt -r 'c.Assert(a, check.DeepEquals, b) -> require.Empty(t, cmp.Diff(a, b))' -w *_test.go
gofmt -r 'c.Assert(a, check.DeepEquals, b, d) -> require.Empty(t, cmp.Diff(a, b), d)' -w *_test.go
gofmt -r 'c.Assert(a, check.Equals, b, d) -> require.Equal(t, a, b, d)' -w *_test.go
gofmt -r 'c.Assert(a, check.ErrorMatches, b) -> require.ErrorContains(t, err, b)' -w *_test.go
gofmt -r 'check.Commentf(a, b) -> fmt.Sprintf(a, b)' -w *_test.go
gofmt -r 'fixtures.DeepCompare(c, a, b) -> require.Empty(t, cmp.Diff(a, b))' -w *_test.go
gofmt -r 'fixtures.ExpectNotFound(c, a) -> require.True(t, trace.IsNotFound(a))' -w *_test.go
gofmt -r 'fixtures.ExpectBadParameter(c, a) -> require.True(t, trace.IsBadParameter(a))' -w *_test.go
gofmt -r 'fixtures.ExpectAlreadyExists(c, a) -> require.True(t, trace.IsAlreadyExists(a))' -w *_test.go
gofmt -r 'fixtures.ExpectLimitExceeded(c, a) -> require.True(t, trace.IsLimitExceeded(a))' -w *_test.go
gofmt -r 'fixtures.ExpectConnectionProblem(c, a) -> require.True(t, trace.IsConnectionProblem(a))' -w *_test.go
gofmt -r 'fixtures.ExpectAccessDenied(c, a) -> require.True(t, trace.IsAccessDenied(a))' -w *_test.go
gofmt -r 'c.Errorf(a) -> t.Errorf(a)' -w *_test.go
gofmt -r 'c.Errorf(a, b) -> t.Errorf(a, b)' -w *_test.go
gofmt -r 'c.Fatalf(a) -> t.Fatalf(a)' -w *_test.go
gofmt -r 'c.Fatalf(a, b) -> t.Fatalf(a, b)' -w *_test.go

@github-actions github-actions Bot requested review from jimbishopp and zmb3 July 8, 2022 01:41
russjones added 2 commits July 7, 2022 19:39
Refactored all tests under "lib/services/suite" to use testify instead
of gocheck.
@russjones russjones force-pushed the rjones/refactor-services branch from dde2579 to af78589 Compare July 8, 2022 02:39
@russjones russjones enabled auto-merge (rebase) July 8, 2022 04:27
@russjones russjones merged commit c62a5ae into master Jul 8, 2022
@russjones russjones deleted the rjones/refactor-services branch July 8, 2022 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants