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

test(binaryinstall): Add initial tests #517

Merged
merged 9 commits into from
Mar 1, 2019

Conversation

drager
Copy link
Member

@drager drager commented Jan 19, 2019

This PR will add some tests to the binary install crate. Please review even that it's WIP. I appreciate any comments what so ever.

@drager
Copy link
Member Author

drager commented Jan 23, 2019

Some things that I would especially appreciate comments on, are about spinning up a local server for testing the downloading of tarballs. I think it's a good idea to spin up a local server rather than hitting a server somewhere else but I'm not sure about the ports of the server. Since the tests are run in parallel, each test that want to spin up a server needs its own port to not get into race condition and error with "port already used". This is somewhat error-prone and not ideal. What are your thoughts about this?

Another thing I'm thinking about is the naming of the tests. Should the function under test be mentioned in the test name? As I have done now it doesn't but maybe that's somewhat weird since all the functions are in the same file?

@drager drager force-pushed the binary-install-tests branch 2 times, most recently from 2c263e4 to f6c2464 Compare January 23, 2019 20:32
@danwilhelm
Copy link
Member

danwilhelm commented Jan 24, 2019

@drager Existing tests already potentially download quite a lot from external servers -- including geckodriver and a few copies of bindgen. I would guess that due to this precedent, downloading from external servers may not be a large concern.

That said, personally I believe that spinning up the local server is quite clever and would save on bandwidth. (And it even works on my Windows machine!)

Regarding the concern with accessing the server from multiple parallel tests, you may want to look at how Fixture implements this. In Fixture lock(), mutexes are used to force sequential access. You can see some examples of using the lock in #522.

Finally, I also noticed you have some tests directly in lib.rs. I am not sure what the standard for this project is, but the wasm-pack tests are all fully contained in the tests directory.

@drager
Copy link
Member Author

drager commented Jan 26, 2019

@danwilhelm Thanks for your comments! Yeah, existing tests in wasm-pack hits external servers, however binary-install will probably be put in it's own repo in the future. I mean, it's not absolutely necessary for binary-install to make the same decisions as wasm-pack but yeah, hitting external servers might not be a large concern, though I like the idea of be able to work fully offline.

Thanks for the suggestion on using lock(), will check that out!

About the tests in lib, my thoughts was that I would put tests in there rather than making functions public that wasn't meant to be public.

@drager
Copy link
Member Author

drager commented Feb 19, 2019

I think it would be great to get your thoughts/review of this @ashleygwilliams, @alexcrichton or @fitzgen. 😊

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Looking good! I made a few comments inline, but I think this would be good to merge after those things are addressed.

Thanks @drager!

.travis.yml Outdated Show resolved Hide resolved
binary-install/src/lib.rs Outdated Show resolved Hide resolved
binary-install/tests/all/utils/mod.rs Outdated Show resolved Hide resolved
test: Put tests that access private functions in tests module
@ashleygwilliams ashleygwilliams modified the milestones: 0.7.0, 0.8.0 Feb 22, 2019
@drager drager changed the title [WIP] test(binaryinstall): Add initial tests test(binaryinstall): Add initial tests Feb 23, 2019
@drager
Copy link
Member Author

drager commented Feb 23, 2019

@fitzgen Thanks for the review! I have now addressed all the comments. Let me know if this is good to go and I can squash all the commits into one.

@ashleygwilliams ashleygwilliams removed the work in progress do not merge! label Feb 27, 2019
Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

i think this is really great! thank you so much for your hard work on this!

@ashleygwilliams ashleygwilliams merged commit 0c45215 into rustwasm:master Mar 1, 2019
@drager drager deleted the binary-install-tests branch March 2, 2019 10:02
@ashleygwilliams ashleygwilliams modified the milestones: 0.8.0, 0.7.0 Mar 14, 2019
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.

5 participants