forked from eclipse-bluechi/bluechi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for getting the system resources of the node
Adds an integration test that verifies if the system resources of the node can be get successfully. Signed-off-by: Joonyoung Shim <[email protected]>
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
summary: Test if the system resources of the node can be get successfully |
22 changes: 22 additions & 0 deletions
22
tests/tests/tier0/system-resources-get/python/get_system_resources.py
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,22 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
import unittest | ||
|
||
from bluechi.api import Node | ||
|
||
|
||
class TestGetSystemResources(unittest.TestCase): | ||
|
||
def test_get_system_resources(self): | ||
node_foo = Node("node-foo") | ||
system_resources = node_foo.get_system_resources() | ||
|
||
assert len(system_resources) == 4 | ||
assert system_resources[0] > 0 | ||
assert system_resources[1] > 0 | ||
assert system_resources[2] > 0 | ||
assert system_resources[3] > 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
30 changes: 30 additions & 0 deletions
30
tests/tests/tier0/system-resources-get/test_system_resources_get.py
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,30 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
import os | ||
import pytest | ||
from typing import Dict | ||
|
||
from bluechi_test.test import BluechiTest | ||
from bluechi_test.container import BluechiControllerContainer, BluechiNodeContainer | ||
from bluechi_test.config import BluechiControllerConfig, BluechiNodeConfig | ||
|
||
|
||
def exec(ctrl: BluechiControllerContainer, nodes: Dict[str, BluechiNodeContainer]): | ||
result, output = ctrl.run_python(os.path.join("python", "get_system_resources.py")) | ||
if result != 0: | ||
raise Exception(output) | ||
|
||
|
||
@pytest.mark.timeout(40) | ||
def test_system_resources_get( | ||
bluechi_test: BluechiTest, | ||
bluechi_ctrl_default_config: BluechiControllerConfig, | ||
bluechi_node_default_config: BluechiNodeConfig): | ||
|
||
bluechi_node_default_config.node_name = "node-foo" | ||
bluechi_ctrl_default_config.allowed_node_names = [bluechi_node_default_config.node_name] | ||
|
||
bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) | ||
bluechi_test.add_bluechi_node_config(bluechi_node_default_config) | ||
|
||
bluechi_test.run(exec) |