Skip to content

Commit

Permalink
ceph_pool: update tests
Browse files Browse the repository at this point in the history
update test_ceph_pool.py due to recent refact

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
  • Loading branch information
guits committed Oct 2, 2020
1 parent 740df37 commit 8f5db07
Showing 1 changed file with 93 additions and 5 deletions.
98 changes: 93 additions & 5 deletions tests/library/test_ceph_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def test_list_pools_nodetails(self):

assert cmd == expected_command

def test_create_replicated_pool(self):
def test_create_replicated_pool_pg_autoscaler_enabled(self):
self.fake_user_pool_config['type']['value'] = 'replicated'
expected_command = [
'podman',
Expand All @@ -429,16 +429,103 @@ def test_create_replicated_pool(self):
'pool',
'create',
self.fake_user_pool_config['pool_name']['value'],
self.fake_user_pool_config['type']['value'],
self.fake_user_pool_config['crush_rule']['value'],
'--expected_num_objects',
self.fake_user_pool_config['expected_num_objects']['value'],
'--autoscale-mode',
self.fake_user_pool_config['pg_autoscale_mode']['value'],
'--size',
self.fake_user_pool_config['size']['value']
]

cmd = ceph_pool.create_pool(fake_cluster_name,
self.fake_user_pool_config['pool_name']['value'],
fake_user, fake_user_key, self.fake_user_pool_config,
container_image=fake_container_image_name)

assert cmd == expected_command

def test_create_replicated_pool_pg_autoscaler_disabled(self):
self.fake_user_pool_config['type']['value'] = 'replicated'
self.fake_user_pool_config['pg_autoscale_mode']['value'] = 'off'
expected_command = [
'podman',
'run',
'--rm',
'--net=host',
'-v',
'/etc/ceph:/etc/ceph:z',
'-v',
'/var/lib/ceph/:/var/lib/ceph/:z',
'-v',
'/var/log/ceph/:/var/log/ceph/:z',
'--entrypoint=ceph',
fake_container_image_name,
'-n',
'client.admin',
'-k',
'/etc/ceph/ceph.client.admin.keyring',
'--cluster',
'ceph',
'osd',
'pool',
'create',
self.fake_user_pool_config['pool_name']['value'],
self.fake_user_pool_config['type']['value'],
'--pg_num',
self.fake_user_pool_config['pg_num']['value'],
'--pgp_num',
self.fake_user_pool_config['pgp_num']['value'],
self.fake_user_pool_config['type']['value'],
self.fake_user_pool_config['crush_rule']['value'],
'--expected_num_objects',
self.fake_user_pool_config['expected_num_objects']['value'],
'--autoscale-mode',
self.fake_user_pool_config['pg_autoscale_mode']['value'],
'--size',
self.fake_user_pool_config['size']['value'],
self.fake_user_pool_config['size']['value']
]

cmd = ceph_pool.create_pool(fake_cluster_name,
self.fake_user_pool_config['pool_name']['value'],
fake_user, fake_user_key,
self.fake_user_pool_config,
container_image=fake_container_image_name)

assert cmd == expected_command

def test_create_erasure_pool_pg_autoscaler_enabled(self):
self.fake_user_pool_config['type']['value'] = 'erasure'
self.fake_user_pool_config['erasure_profile']['value'] = 'erasure-default'
self.fake_user_pool_config['crush_rule']['value'] = 'erasure_rule'
expected_command = [
'podman',
'run',
'--rm',
'--net=host',
'-v',
'/etc/ceph:/etc/ceph:z',
'-v',
'/var/lib/ceph/:/var/lib/ceph/:z',
'-v',
'/var/log/ceph/:/var/log/ceph/:z',
'--entrypoint=ceph',
fake_container_image_name,
'-n',
'client.admin',
'-k',
'/etc/ceph/ceph.client.admin.keyring',
'--cluster',
'ceph',
'osd',
'pool',
'create',
self.fake_user_pool_config['pool_name']['value'],
self.fake_user_pool_config['type']['value'],
self.fake_user_pool_config['erasure_profile']['value'],
self.fake_user_pool_config['crush_rule']['value'],
'--expected_num_objects',
self.fake_user_pool_config['expected_num_objects']['value'],
'--autoscale-mode',
self.fake_user_pool_config['pg_autoscale_mode']['value']
]
Expand All @@ -450,10 +537,11 @@ def test_create_replicated_pool(self):

assert cmd == expected_command

def test_create_erasure_pool(self):
def test_create_erasure_pool_pg_autoscaler_disabled(self):
self.fake_user_pool_config['type']['value'] = 'erasure'
self.fake_user_pool_config['erasure_profile']['value'] = 'erasure-default'
self.fake_user_pool_config['crush_rule']['value'] = 'erasure_rule'
self.fake_user_pool_config['pg_autoscale_mode']['value'] = 'off'
expected_command = [
'podman',
'run',
Expand All @@ -477,11 +565,11 @@ def test_create_erasure_pool(self):
'pool',
'create',
self.fake_user_pool_config['pool_name']['value'],
self.fake_user_pool_config['type']['value'],
'--pg_num',
self.fake_user_pool_config['pg_num']['value'],
'--pgp_num',
self.fake_user_pool_config['pgp_num']['value'],
self.fake_user_pool_config['type']['value'],
self.fake_user_pool_config['erasure_profile']['value'],
self.fake_user_pool_config['crush_rule']['value'],
'--expected_num_objects',
Expand Down

0 comments on commit 8f5db07

Please sign in to comment.