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

cleanup clippy tests #10172

Merged
merged 4 commits into from
May 29, 2020
Merged

Conversation

svenski123
Copy link
Contributor

Problem

Clippy complaints in test code have clept in again.

Summary of Changes

Clean up the clippy complaints

@mvines
Copy link
Member

mvines commented May 22, 2020

Strange, test_vote_subscribe seems to be failing 2 out of 2 times with this PR 🤔

@ryoqun
Copy link
Member

ryoqun commented May 22, 2020

@mvines Well, I thought rpc_pubsub::tests::test_vote_subscribe has been flaky for some time.

@ryoqun
Copy link
Member

ryoqun commented May 22, 2020

Thanks for working on this again!!

@svenski123 How about enabling this in this pr?: #10030 (comment) Otherwise, this surely reoccurs. Let's close the gap!:

cargo check and cargo clippy --tests are clean.

@svenski123 Wow. What a stamina you have! Legend thanks!! So, are you confident and ready to receive my dearest honor of adding --tests here?:

_ cargo +"$rust_stable" clippy --all --exclude solana-sdk-c -- --deny=warnings

Also, your concern at #5503 is fixed already. :)

from my comment there:

We rather want to enable --tests (or equivalent) sooner or later otherwise we'll introduce more clippy errors because CI won't complain, including me ;)

I guessed this will occur. xD

Also, you don't need to run all of ci tests locally, just believe your edit and test it on our ci. For these tiny edits this is enough.

@@ -895,8 +895,7 @@ mod tests {
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("voteNotification");

// Setup Subscriptions
let subscriptions =
RpcSubscriptions::new(&exit, bank_forks.clone(), block_commitment_cache.clone());
let subscriptions = RpcSubscriptions::new(&exit, bank_forks, block_commitment_cache);
Copy link
Member

Choose a reason for hiding this comment

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

@svenski123 Could you check the flakiness of this test test_vote_subscribe locally? it seems like this test got a lot unstable with removing .clone() on ci:

My guess is that this or that .clone() takes some time and removing that makes it more susceptible to the some kind of race condition. If you're brave enough, feel free to go down the rabbit hole or just add #allow(...)...

FYI, this test has been a bit flaky for some time, iirc.

@svenski123
Copy link
Contributor Author

Having removed clippy complaints before, I obviously couldn't reintroduce them again in #9980 (though not using a type alias for tuple-of-hash-of-integer-to-vector-of-struct wasn't my idea :)).

So I tugged on that thread and some more stuff fell out - hence this PR.

test_vote_subscribe fails locally - seems one of the channels gets closed prematurely, and this is somehow linked to the earlier drop due to one of the missing clones. So this testcase needs to be picked apart a bit, gone through and put together (rather than simply sticking the clone back in).

@ryoqun
Copy link
Member

ryoqun commented May 22, 2020

Having removed clippy complaints before, I obviously couldn't reintroduce them again in #9980 (though not using a type alias for tuple-of-hash-of-integer-to-vector-of-struct wasn't my idea :)).

hehe ;) I was pretty sure you'll introduce one for it.

So I tugged on that thread and some more stuff fell out - hence this PR.

I see

test_vote_subscribe fails locally - seems one of the channels gets closed prematurely, and this is somehow linked to the earlier drop due to one of the missing clones. So this testcase needs to be picked apart a bit, gone through and put together (rather than simply sticking the clone back in).

Hehe, it seems that you're interested. Thanks!

@ryoqun
Copy link
Member

ryoqun commented May 27, 2020

@svenski123 How is this going? :) Still trying to fix the root cause? Or am I making you to wait for something? You can fix it at your pace, but rahter I want to merge the rest of clippy nice fixes you did and ci/test-check.sh change first. :)

@svenski123
Copy link
Contributor Author

Hi @ryoqun ! Apologies I've not had much time for development this week so this has been dragging out. Also there's quite a lot going on in that testcase and rust's various async / Future related libraries take some time to work through. I'll try to get to it this evening but if not I'll put the clone back that makes it work with a clippy override to unblock this.

@svenski123 svenski123 force-pushed the clippy-cleanup-001 branch from 2eee7b2 to a12ae1c Compare May 28, 2020 23:57
@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #10172 into master will decrease coverage by 0.0%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #10172     +/-   ##
=========================================
- Coverage    81.3%    81.3%   -0.1%     
=========================================
  Files         288      288             
  Lines       66906    66915      +9     
=========================================
+ Hits        54433    54437      +4     
- Misses      12473    12478      +5     

Copy link
Member

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

LGTM!

@ryoqun ryoqun added the automerge Merge this Pull Request automatically once CI passes label May 29, 2020
@ryoqun
Copy link
Member

ryoqun commented May 29, 2020

Hi @ryoqun ! Apologies I've not had much time for development this week so this has been dragging out.

I see! Please take your time. There should be no rush. :)

Also there's quite a lot going on in that testcase and rust's various async / Future related libraries take some time to work through. I'll try to get to it this evening but if not I'll put the clone back that makes it work with a clippy override to unblock this.

Oh I see! I'm also not that knowledgeable with that test, too... Thanks for looking! Also, feel free ask any questions if that's makes it easy for you.

For now, let's merge the rest! We always welcome your contribution. :)

@solana-grimes solana-grimes merged commit fb4d8e1 into solana-labs:master May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants