def test_urls_dedicated_node(self, masterpillarutil, config, localclient): expected = { 'url': "http://rgw1:7480/admin", 'ssl': False, 'port': '7480', 'host': 'rgw1' } localclient().cmd.return_value = {'rgw1': {'fqdn': 'rgw1'}} fs.CreateFile( 'cache/client.rgw.rgw1.json', contents= '''[client.rgw.rgw1]\nkey = 12345\ncaps mon = "allow rwx"\ncaps osd = "allow rwx"\n''' ) fs.CreateFile( '/srv/salt/ceph/configuration/files/rgw.conf', contents= '''[client.rgw.rgw1]\nkey = 12345\ncaps mon = "allow rwx"\ncaps osd = "allow rwx"\n''' ) result = rgw.endpoints()[0] fs.RemoveFile('cache/client.rgw.rgw1.json') fs.RemoveFile('/srv/salt/ceph/configuration/files/rgw.conf') assert cmp(expected, result) == 0
def test_urls_endpoint_defined(self, masterpillarutil, config, localclient): expected = {'url': "http://abc.def/admin", 'ssl': False, 'port': 7480, 'host': 'abc.def/admin' } mpu = masterpillarutil.return_value mpu.get_minion_pillar.return_value = { "minionA": { "rgw_endpoint": "http://abc.def/admin" }} result = rgw.endpoints()[0] assert expected == result
def test_urls_dedicated_node_with_admin_entry(self, masterpillarutil, config, localclient): expected = {'url': "https://rgw1:443/sys", 'ssl': True, 'port': 443, 'host': 'rgw1' } localclient().cmd.return_value = { 'rgw1': { 'fqdn': 'rgw1' } } fs.CreateFile('cache/client.rgw.rgw1.json') fs.CreateFile('/srv/salt/ceph/configuration/files/rgw.conf', contents='''[client.rgw.rgw1]\nrgw_frontends = civetweb port=443s\nkey = 12345\ncaps mon = "allow rwx"\ncaps osd = "allow rwx"\nrgw admin entry = sys\n''') result = rgw.endpoints()[0] fs.RemoveFile('cache/client.rgw.rgw1.json') fs.RemoveFile('/srv/salt/ceph/configuration/files/rgw.conf') assert expected == result
def test_urls_shared_node_with_ssl(self, masterpillarutil, config, localclient): expected = {'url': "https://rgw:443/admin", 'ssl': True, 'port': 443, 'host': 'rgw' } localclient().cmd.return_value = { 'rgw1': { 'fqdn': 'rgw' } } fs.CreateFile('cache/client.rgw.json') fs.CreateFile('/srv/salt/ceph/configuration/files/rgw.conf', contents='''[client.rgw.rgw1]\nrgw_frontends = civetweb port=443s ssl_certificate=/etc/ceph/private/keyandcert.pem\nkey = 12345\ncaps mon = "allow rwx"\ncaps osd = "allow rwx"\n''') result = rgw.endpoints()[0] fs.RemoveFile('cache/client.rgw.json') fs.RemoveFile('/srv/salt/ceph/configuration/files/rgw.conf') assert expected == result