Skip to content

Commit

Permalink
pool form tests for application metadata on submit
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Müller <smueller@suse.com>
  • Loading branch information
Stephan Müller committed Jun 15, 2018
1 parent 786fab3 commit 9f7f260
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ describe('PoolFormComponent', () => {
});
});
});

describe('submit', () => {
const setMultipleValues = (settings: {}) => {
Object.keys(settings).forEach((name) => {
Expand Down Expand Up @@ -720,6 +721,7 @@ describe('PoolFormComponent', () => {
flags: ['ec_overwrites']
});
});

it('should test pool compression', () => {
setMultipleValues({
name: 'compression',
Expand All @@ -743,6 +745,23 @@ describe('PoolFormComponent', () => {
compression_required_ratio: 0.7
});
});

it('should test application metadata', () => {
setMultipleValues({
name: 'apps',
poolType: 'erasure',
pgNum: 128
});
component.addApp('rgw');
component.addApp('cephfs');
component.submit();
expect(component.createAction).toHaveBeenCalledWith({
pool: 'apps',
pool_type: 'erasure',
pg_num: 128,
application_metadata: ['cephfs', 'rgw']
});
});
});

describe('edit mode', () => {
Expand Down Expand Up @@ -835,6 +854,23 @@ describe('PoolFormComponent', () => {
isValid(setValue('pgNum', 64));
hasError(setValue('pgNum', 4), 'noDecrease');
});

it('should test that apps are provided on submit if the app list is empty', () => {
spyOn(component, 'createAction');
component.removeApp('rbd');
component.removeApp('rgw');
component.submit();
expect(component.createAction).toHaveBeenCalledWith({
application_metadata: [],
compression_algorithm: 'lz4',
compression_max_blob_size: 1048576,
compression_min_blob_size: 524288,
compression_mode: 'passive',
compression_required_ratio: 0.8,
pg_num: 32,
pool: 'somePoolName'
});
});
});
});
});

0 comments on commit 9f7f260

Please sign in to comment.