-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Basic testing support covering RGW/Outscale storage drivers Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import sys | ||
import unittest | ||
|
||
from libcloud.storage.drivers.rgw import S3RGWStorageDriver | ||
from libcloud.storage.drivers.rgw import S3RGWOutscaleStorageDriver | ||
from libcloud.storage.drivers.rgw import S3RGWConnectionAWS4 | ||
from libcloud.storage.drivers.rgw import S3RGWConnectionAWS2 | ||
|
||
from libcloud.test.secrets import STORAGE_S3_PARAMS | ||
|
||
|
||
class S3RGWTests(unittest.TestCase): | ||
driver_type = S3RGWStorageDriver | ||
driver_args = STORAGE_S3_PARAMS | ||
default_host = 'localhost' | ||
|
||
@classmethod | ||
def create_driver(self): | ||
return self.driver_type(*self.driver_args, | ||
signature_version='2', | ||
host=self.default_host) | ||
|
||
def setUp(self): | ||
self.driver = self.create_driver() | ||
|
||
def test_connection_class_type(self): | ||
res = self.driver.connectionCls is S3RGWConnectionAWS2 | ||
self.assertTrue(res, 'driver.connectionCls does not match!') | ||
|
||
def test_connection_class_host(self): | ||
host = self.driver.connectionCls.host | ||
self.assertEqual(host, self.default_host) | ||
|
||
|
||
class S3RGWOutscaleTests(S3RGWTests): | ||
driver_type = S3RGWOutscaleStorageDriver | ||
default_host = 'osu.eu-west-2.outscale.com' | ||
|
||
@classmethod | ||
def create_driver(self): | ||
return self.driver_type(*self.driver_args, | ||
signature_version='4') | ||
|
||
def test_connection_class_type(self): | ||
res = self.driver.connectionCls is S3RGWConnectionAWS4 | ||
self.assertTrue(res, 'driver.connectionCls does not match!') | ||
|
||
def test_connection_class_host(self): | ||
host = self.driver.connectionCls.host | ||
self.assertEqual(host, self.default_host) | ||
|
||
|
||
class S3RGWOutscaleDoubleInstanceTests(S3RGWTests): | ||
driver_type = S3RGWOutscaleStorageDriver | ||
|
||
@classmethod | ||
def create_driver(self): | ||
d = self.driver_type(*self.driver_args, signature_version='4') | ||
_ = self.driver_type(*self.driver_args, signature_version='2') | ||
return d | ||
|
||
def test_connection_class_type(self): | ||
res = self.driver.connectionCls is S3RGWConnectionAWS4 | ||
self.assertTrue(res, 'driver.connectionCls does not match!') | ||
|
||
def test_connection_class_host(self): | ||
host = self.driver.connectionCls.host | ||
self.assertEqual(host, 'osu.eu-west-2.outscale.com') | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(unittest.main()) |