Merge "Check if swift is alive instead of hardcode"
This commit is contained in:
commit
f43fff9ff5
@ -46,7 +46,12 @@ class DataDriver(storage.DataDriverBase):
|
|||||||
return _ClientWrapper(self.swift_conf)
|
return _ClientWrapper(self.swift_conf)
|
||||||
|
|
||||||
def is_alive(self):
|
def is_alive(self):
|
||||||
return True
|
try:
|
||||||
|
self.connection.get_capabilities()
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
LOG.exception(e)
|
||||||
|
return False
|
||||||
|
|
||||||
@decorators.lazy_property(write=False)
|
@decorators.lazy_property(write=False)
|
||||||
def queue_controller(self):
|
def queue_controller(self):
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# implied.
|
# implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
from zaqar.common import cache as oslo_cache
|
||||||
from zaqar.storage import mongodb
|
from zaqar.storage import mongodb
|
||||||
from zaqar.storage.swift import controllers
|
from zaqar.storage.swift import controllers
|
||||||
from zaqar.storage.swift import driver
|
from zaqar.storage.swift import driver
|
||||||
@ -50,3 +50,17 @@ class SwiftSubscriptionsTest(base.SubscriptionControllerTest):
|
|||||||
config_file = 'wsgi_swift.conf'
|
config_file = 'wsgi_swift.conf'
|
||||||
controller_class = controllers.SubscriptionController
|
controller_class = controllers.SubscriptionController
|
||||||
control_driver_class = mongodb.ControlDriver
|
control_driver_class = mongodb.ControlDriver
|
||||||
|
|
||||||
|
|
||||||
|
@testing.requires_swift
|
||||||
|
class SwiftDriverTest(testing.TestBase):
|
||||||
|
config_file = 'wsgi_swift.conf'
|
||||||
|
|
||||||
|
def test_is_alive(self):
|
||||||
|
oslo_cache.register_config(self.conf)
|
||||||
|
cache = oslo_cache.get_cache(self.conf)
|
||||||
|
swift_driver = driver.DataDriver(self.conf, cache,
|
||||||
|
mongodb.ControlDriver
|
||||||
|
(self.conf, cache))
|
||||||
|
|
||||||
|
self.assertTrue(swift_driver.is_alive())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user