-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mock bugtool plugin and test it being loaded by load_plugins()
- Loading branch information
1 parent
c06992e
commit 0c43534
Showing
5 changed files
with
63 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<capability pii="yes" max_size="16384" max_time="60" mime="text/plain" checked="true"/> |
6 changes: 6 additions & 0 deletions
6
tests/integration/dom0-template/etc/xensource/bugtool/mock/stuff.xml
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,6 @@ | ||
<collect> | ||
<list>/etc</list> | ||
<files>/proc/self/status</files> | ||
<directory pattern=".*ax_user_watches">/proc/sys/fs/epoll</directory> | ||
<command label="proc_version">cat /proc/version</command> | ||
</collect> |
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,48 @@ | ||
"""Regression tests for bugtool.load_plugins()""" | ||
|
||
|
||
def test_load_plugins(bugtool, dom0_template): | ||
"""Assert () returning arrays of the in the dom0-template""" | ||
|
||
# Use the plugins found in the dom0_template "/etc/xensource/bugtool": | ||
bugtool.PLUGIN_DIR = dom0_template + "/etc/xensource/bugtool" | ||
# Only process the mock bugtool plugin: | ||
bugtool.entries = ["mock"] | ||
# Load the mock plugin: | ||
bugtool.load_plugins(just_capabilities=False) | ||
# Assert the set of properties of the created mock capability: | ||
assert bugtool.caps["mock"] == ( | ||
"mock", | ||
"yes", | ||
-1, | ||
16384, | ||
-1, | ||
60, | ||
"text/plain", | ||
True, | ||
False, | ||
9, | ||
) | ||
# Assert the size of the created mock capability: | ||
assert bugtool.cap_sizes["mock"] == 0 | ||
# Assert the entries added to the bugtool.data dict: | ||
assert bugtool.data == { | ||
"ls -l /etc": { | ||
"cap": "mock", | ||
"cmd_args": ["ls", "-l", "/etc"], | ||
"filter": None, | ||
}, | ||
"/proc/self/status": { | ||
"cap": "mock", | ||
"filename": "/proc/self/status", | ||
}, | ||
"/proc/sys/fs/epoll/max_user_watches": { | ||
"cap": "mock", | ||
"filename": "/proc/sys/fs/epoll/max_user_watches", | ||
}, | ||
"proc_version": { | ||
"cap": "mock", | ||
"cmd_args": "cat /proc/version", | ||
"filter": None, | ||
}, | ||
} |
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