-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jobs audit.
pool.update
audit (#14357)
- Loading branch information
1 parent
1218dea
commit 10a978c
Showing
4 changed files
with
88 additions
and
12 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
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
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
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,39 @@ | ||
import pytest | ||
|
||
from middlewared.test.integration.assets.pool import another_pool | ||
from middlewared.test.integration.utils import call | ||
from middlewared.test.integration.utils.audit import expect_audit_log | ||
|
||
|
||
def test_pool_update_audit_success(): | ||
with another_pool() as pool: | ||
params = [pool['id'], {'autotrim': 'ON'}] | ||
with expect_audit_log([{ | ||
'event_data': { | ||
'authenticated': True, | ||
'authorized': True, | ||
'method': 'pool.update', | ||
'params': params, | ||
'description': f'Pool update test', | ||
}, | ||
'success': True, | ||
}]): | ||
call('pool.update', *params, job=True) | ||
|
||
|
||
def test_pool_update_audit_error(): | ||
with another_pool() as pool: | ||
params = [pool['id'], {'topology': {'spares': ['nonexistent']}}] | ||
|
||
with expect_audit_log([{ | ||
'event_data': { | ||
'authenticated': True, | ||
'authorized': True, | ||
'method': 'pool.update', | ||
'params': params, | ||
'description': f'Pool update test', | ||
}, | ||
'success': False, | ||
}]): | ||
with pytest.raises(Exception): | ||
call('pool.update', *params, job=True) |