Got Error when running Unittest tests.test_compute_service.test_instance_methods
- Dominant language
- Python
- Stars
- 117
- Forks
- 51
- Avg merge
- 9h 17m
- Merged PRs (30d)
- 5
Description
Thanks a lot for providing such an excellent lib, I love it very much!
Python Environment: Python 3.6.7
Envs: CB_TEST_PROVIDER=gcp;GCP_DEFAULT_REGION=asia-east1;GCP_ZONE_NAME=asia-east1-b
when I am trying to run tests/test_compute_service.test_instance_methods,
Got Result: Tests Passed 6 of 6 tests, but got exception (Error during cleanup: 'NoneType' object has no attribute '_ip') when cleaning the resource floating ip.
It looks like the test code is waiting the GCPFloatingIP state change to FloatingIpState.UNKNOWN, but GCPFloatingIP.state only returns FloatingIpState.IN_USE or FloatingIpState.AVAILABLE. So the test code `fip.wait_for([FloatingIpState.UNKNOWN],
terminal_states=[FloatingIpState.ERROR])` is an infinite loop.
when the GCPFloatingIP is freed, the code in cloudbridge/providers/gcp/resources.py Class GCPFloatingIP function refresh`fip = self._provider.networking._floating_ips.get(None, self.id)`
the get function above returned None which is causing Exception 'NoneType' object has no attribute '_ip'
Detailed Error Stack are as follows
`Error during cleanup: CloudBridgeBaseException: from exception type:
Traceback (most recent call last):
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/middleware.py", line 45, in wrap_exception
return next_handler.invoke(event_args, *args, **kwargs)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/pyeventsystem/events.py", line 110, in invoke
result = self.callback(*args, **kwargs)
File "/home/niejjn/codes/cloudbridge/cloudbridge/providers/gcp/services.py", line 1225, in delete
disk=volume.name)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/http.py", line 851, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/helpers.py", line 110, in cleanup_action
cleanup_func()
File "/home/niejjn/codes/cloudbridge/tests/test_compute_service.py", line 245, in
with cb_helpers.cleanup_action(lambda: test_vol.delete()):
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/resources.py", line 469, in delete
return self._provider.storage.volumes.delete(self)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/pyeventsystem/middleware.py", line 74, in wrapper
return dispatcher.dispatch(self, event, *args, **kwargs)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/pyeventsystem/events.py", line 218, in dispatch
return handlers[0].invoke(event_args, *args, **kwargs)
File "/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/pyeventsystem/events.py", line 78, in invoke
result = self.callback(event_args, *args, **kwargs)
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/middleware.py", line 55, in wrap_exception
six.raise_from(cb_ex, e)
File "", line 3, in raise_from
cloudbridge.interfaces.exceptions.CloudBridgeBaseException: CloudBridgeBaseException: from exception type:
/home/niejjn/codes/cloudbridge/cloudbridge/factory.py:75: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
log.warn("Could not import provider: %s", e)
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/_helpers.py:130: ResourceWarning: unclosed
return wrapped(*args, **kwargs)
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/_helpers.py:130: ResourceWarning: unclosed
return wrapped(*args, **kwargs)
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/six.py:587: ResourceWarning: unclosed
return iter(d.items(**kw))
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/six.py:587: ResourceWarning: unclosed
return iter(d.items(**kw))
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/six.py:587: ResourceWarning: unclosed
return iter(d.items(**kw))
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/six.py:587: ResourceWarning: unclosed
return iter(d.items(**kw))
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/_helpers.py:130: ResourceWarning: unclosed
return wrapped(*args, **kwargs)
Error during cleanup: 'NoneType' object has no attribute '_ip'
Traceback (most recent call last):
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/helpers.py", line 110, in cleanup_action
cleanup_func()
File "/home/niejjn/codes/cloudbridge/tests/test_compute_service.py", line 372, in
lambda: helpers.cleanup_fip(fip)):
File "/home/niejjn/codes/cloudbridge/tests/helpers/__init__.py", line 164, in cleanup_fip
terminal_states=[FloatingIpState.ERROR])
File "/home/niejjn/codes/cloudbridge/cloudbridge/base/resources.py", line 168, in wait_for
self.refresh()
File "/home/niejjn/codes/cloudbridge/cloudbridge/providers/gcp/resources.py", line 1385, in refresh
self._ip = fip._ip
AttributeError: 'NoneType' object has no attribute '_ip'
/usr/lib/python3.6/json/decoder.py:355: ResourceWarning: unclosed
obj, end = self.scan_once(s, idx)
/usr/lib/python3.6/json/decoder.py:355: ResourceWarning: unclosed
obj, end = self.scan_once(s, idx)
/usr/lib/python3.6/json/decoder.py:355: ResourceWarning: unclosed
obj, end = self.scan_once(s, idx)
/usr/lib/python3.6/json/decoder.py:355: ResourceWarning: unclosed
obj, end = self.scan_once(s, idx)
/home/niejjn/cloudbridge-2/cloudbridge-2.0.0/venv/lib/python3.6/site-packages/google_api_python_client-1.7.8-py3.6.egg/googleapiclient/_helpers.py:130: ResourceWarning: unclosed
return wrapped(*args, **kwargs)
Ran 6 tests in 1233.988s
OK`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.