You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ekorsky@abyrd I added the fix/PR from OTP1 to OTP2, but I changed the test slightly - the test fails if there is no internet connection(false positive). I added an "assumeConnectedToInternet()" in the test. The test is ignored if there is no internet connection.
Thanks @t2gran. I'm wondering though whether we should have any tests that rely on having an internet connection, and rely on an external service producing output. This is as much a test of the BANO service itself (and the entire internet between the build machine and that service) as it is a test of OTP. Really that external service should be mocked up.
I understand that you've made this less problematic by disabling the test when there's no internet connection, but that still feels strange to me - if the OTP component was broken, we could get a false test pass just by the network connection accidentally dropping. It seems like bad form overall.
I see it as an integration test, verifying that the API do not change and exist. The installations of OTP that uses this geocoder will probably notice that something is wrong long before any accidental unit tests are run - so I support removing it or mocking the external service.
@t2gran@abyrd for other projects (not in Java), we use libraries to record external service requests (to a YAML or JSON file that's checked into the repo); the library then creates a mock for the test, playing back the stored response.
We talked about replacing it with a test fixture file and mocking the external service, and I started looking into it. But when considering what that mock should look like, I realized this will make the test pretty self-referential, and it will no longer really test anything. A mocked service that always returns the same address doesn't verify that the URL being constructed is compatible with the current version of the API out on the web, nor the interaction between the bounding box and the search string, etc.
Activity
t2gran commentedon Jul 30, 2019
@ekorsky @abyrd I added the fix/PR from OTP1 to OTP2, but I changed the test slightly - the test fails if there is no internet connection(false positive). I added an "assumeConnectedToInternet()" in the test. The test is ignored if there is no internet connection.
abyrd commentedon Jul 30, 2019
Thanks @t2gran. I'm wondering though whether we should have any tests that rely on having an internet connection, and rely on an external service producing output. This is as much a test of the BANO service itself (and the entire internet between the build machine and that service) as it is a test of OTP. Really that external service should be mocked up.
I understand that you've made this less problematic by disabling the test when there's no internet connection, but that still feels strange to me - if the OTP component was broken, we could get a false test pass just by the network connection accidentally dropping. It seems like bad form overall.
t2gran commentedon Jul 30, 2019
I see it as an integration test, verifying that the API do not change and exist. The installations of OTP that uses this geocoder will probably notice that something is wrong long before any accidental unit tests are run - so I support removing it or mocking the external service.
drewda commentedon Jul 30, 2019
@t2gran @abyrd for other projects (not in Java), we use libraries to record external service requests (to a YAML or JSON file that's checked into the repo); the library then creates a mock for the test, playing back the stored response.
abyrd commentedon Jul 31, 2019
We talked about replacing it with a test fixture file and mocking the external service, and I started looking into it. But when considering what that mock should look like, I realized this will make the test pretty self-referential, and it will no longer really test anything. A mocked service that always returns the same address doesn't verify that the URL being constructed is compatible with the current version of the API out on the web, nor the interaction between the bounding box and the search string, etc.
I'm going to just apply @t2gran's fix from #2800.