Skip to content

Refactor tests under services package#14187

Merged
russjones merged 2 commits intomasterfrom
rjones/suite-refactor
Jul 8, 2022
Merged

Refactor tests under services package#14187
russjones merged 2 commits intomasterfrom
rjones/suite-refactor

Conversation

@russjones
Copy link
Copy Markdown
Contributor

@russjones russjones commented Jul 7, 2022

Refactored lib/services/suite and lib/services/local packages to use testify instead of gocheck.

Swapped backend from lite to memory to cut time to run tests in half.


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

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

@russjones russjones requested review from r0mant and zmb3 July 7, 2022 15:45
@github-actions github-actions Bot requested a review from jimbishopp July 7, 2022 15:45
Refactored "lib/services/suite" and "lib/services/local" packages to use
testify instead of gocheck.

Swapped backend from "lite" to "memory" to cut time to run tests in
half.
@russjones russjones force-pushed the rjones/suite-refactor branch from 0765773 to 7f23ff9 Compare July 7, 2022 23:39
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