taurus
taurus copied to clipboard
Handle HTTP 500 errors in update check
There was no checking of a proper response before attempting to decode JSON. When the server returns an HTTP 500, we get an error when attempting to decode a non-existent JSON response. Now, we first check that the response is not HTTP 500.
I see that the test suite has failed here:
======================================================================
[1270](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1270)ERROR: test_check_for_updates (unit.test_engine.TestEngine)
[1271](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1271)----------------------------------------------------------------------
[1272](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1272)Traceback (most recent call last):
[1273](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1273) File "C:\projects\taurus-bfy06\tests\unit\test_engine.py", line 183, in test_check_for_updates
[1274](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1274) self.obj._check_updates('bla-bla')
[1275](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1275) File "C:\projects\taurus-bfy06\bzt\engine\engine.py", line 734, in _check_updates
[1276](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1276) if response.status_code == 500:
[1277](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1277)AttributeError: 'MockClient' object has no attribute 'status_code'
[1278](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1278)
[1279](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1279)----------------------------------------------------------------------
[1280](https://ci.appveyor.com/project/greyfenrir/taurus-bfy06/builds/42433759#L1280)
When testing locally, using an instance of bzt.utils.HTTPClient()
, I was able to access the property response.status_code
. How can I resolve this?
Closing, fixed by https://github.com/Blazemeter/taurus/commit/361881cb8dffad4ed9a4d6200f734b2b62170c3b