-
Notifications
You must be signed in to change notification settings - Fork 51
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
Mocking of http requests #917
base: develop
Are you sure you want to change the base?
Conversation
I tried activating this for all tests, but ran into issues with the HiGlassComponentTests. There seem to be strange sync/async issues that result from loading tiles from the file system. Therefore I only activated this for the DenseDataExtremaTest for now. I still think it is useful to provide the functionality especially for new tests. It is more automatic than the local tile fetcher and mocks all http requests (not only the tile data). |
If I wanted to write a mock test for, say, a plug-in to render a bigBed file, what would be the most relevant parts of the code to look at? |
You can have a look here how existing tests have to be modified: |
The idea is to make a bigBed renderer available in a future version of the official The bigBed renderer is written, but the tests are the last piece needed to complete the PR (#805). |
I see. The FetchMockHelper doesn't care where the http request points to. Loading (and persisting data) from a S3 bucket shouldn't be a problem. |
Description
This PR enables the automatic mocking of http requests made during running the tests. Instead of going to the server (defined in the view config of a test), we are now looking first if the data already exists in 'test/mocked-responses'. If it does exists, we take the data from there and don't request it from the server. If the data is not there, we make the original http request and store the received data in a file. Therefore, the actual http request should always only happen on the local machine. Travis should always have persisted data and does no longer depend on the availability of a server.
This also enables the use of artificial test data that only exists on a local server.
The procedure of adding new tests and view configs will not change. We can just add view configs as usual. Storing the data in local files and using the data from there happens automatically.
Note, that this PR activates the request mocking only for the DenseDataExtremaTests. Other (or new) tests can be added on an as-needed basis.
To make the tests more resilient.
Fixes #___
Checklist