Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: fix some testifylint warnings #4932

Merged
merged 1 commit into from
May 31, 2024

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented May 15, 2024

depends on #4931 (only last commit new)

This does not cover all warnings yet but split into chunks to ease review. There are quite a lot of updates needed so we can do them in multiple PRs so that there isn't a big review or bad rebase needed.

@tonistiigi tonistiigi force-pushed the testifylint-fixes1 branch from b353164 to 4e87d62 Compare May 17, 2024 04:32
@tonistiigi tonistiigi marked this pull request as ready for review May 17, 2024 04:32
@tonistiigi tonistiigi force-pushed the testifylint-fixes1 branch from 4e87d62 to fae33ad Compare May 28, 2024 22:41
@tonistiigi tonistiigi requested a review from crazy-max May 28, 2024 22:46
@tonistiigi tonistiigi added this to the v0.14.0 milestone May 28, 2024
@tonistiigi tonistiigi force-pushed the testifylint-fixes1 branch from fae33ad to 0e1757f Compare May 29, 2024 16:41
@crazy-max
Copy link
Member

This one looks legit: https://github.com/moby/buildkit/actions/runs/9289931268/job/25613491736?pr=4932#step:8:2933

 === FAIL: worker/runc TestRuncWorker (0.99s)
    runc_test.go:101: 
        	Error Trace:	/src/worker/runc/runc_test.go:101
        	Error:      	Elements should be the same type
        	Test:       	TestRuncWorker

@tonistiigi tonistiigi force-pushed the testifylint-fixes1 branch from 0e1757f to c43b9ad Compare May 30, 2024 17:49
Copy link
Collaborator

@jsternberg jsternberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks fine. Had a few questions before I approve.

@@ -288,8 +289,8 @@ func TestCacheMountLockedRefs(t *testing.T) {
gotRef4 := make(chan struct{})
go func() {
ref4, err := g2.getRefCacheDir(ctx, nil, "foo", pb.CacheSharingOpt_LOCKED)
require.NoError(t, err)
require.Equal(t, ref.ID(), ref4.ID())
assert.NoError(t, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this sometimes changed from assert.NoError to require.NoError and other times it's the opposite? Is this because this is in a goroutine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the rule is that require is not allowed in goroutines, same as https://pkg.go.dev/testing#B.FailNow

@@ -23,6 +23,7 @@ linters:
- nolintlint
- revive
- staticcheck
# - testifylint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out here? Is it just because it doesn't fix everything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is only the first batch

This does not cover all warning yet but split
into chunks to ease review.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the testifylint-fixes1 branch from c43b9ad to 03c7a6d Compare May 30, 2024 18:33
@tonistiigi tonistiigi merged commit 843be86 into moby:master May 31, 2024
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants