Ceph S3 RGW storage drivers tests - Basic testing support covering RGW/Outscale storage drivers
Closes #792 Signed-off-by: Javier M. Mellid <[email protected]> Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/10dae7b3 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/10dae7b3 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/10dae7b3 Branch: refs/heads/trunk Commit: 10dae7b35c5595b71c6259ed9761fed59e318684 Parents: 0062f8b Author: Javier M. Mellid <[email protected]> Authored: Fri May 20 15:14:11 2016 +0000 Committer: Tomaz Muraus <[email protected]> Committed: Sun May 22 12:06:05 2016 +0200 ---------------------------------------------------------------------- libcloud/test/storage/test_rgw.py | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/10dae7b3/libcloud/test/storage/test_rgw.py ---------------------------------------------------------------------- diff --git a/libcloud/test/storage/test_rgw.py b/libcloud/test/storage/test_rgw.py new file mode 100644 index 0000000..3b00f28 --- /dev/null +++ b/libcloud/test/storage/test_rgw.py @@ -0,0 +1,73 @@ +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 + default_host = 'osu.eu-west-2.outscale.com' + + @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, self.default_host) + + +if __name__ == '__main__': + sys.exit(unittest.main())
