-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support monitoring api for cpu/memory utilization
- Loading branch information
1 parent
7037e2b
commit c7bf270
Showing
3 changed files
with
209 additions
and
1 deletion.
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
52 changes: 52 additions & 0 deletions
52
perfmetrics/scripts/testing_on_gke/examples/utils/utils_test.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,52 @@ | ||
"""This file defines unit tests for functionalities in utils.py""" | ||
|
||
import unittest | ||
import utils | ||
from utils import get_cpu_from_monitoring_api, get_memory_from_monitoring_api | ||
|
||
|
||
class UtilsTest(unittest.TestCase): | ||
|
||
def test_get_cpu_from_monitoring_api(self): | ||
project_id = "gcs-fuse-test" | ||
cluster_name = "gargnitin-dryrun-us-west1-6" | ||
pod_name = "fio-tester-gcsfuse-rr-64k-1670041227260535313" | ||
# container_name = "fio-tester" | ||
namespace_name = "default" | ||
start_epoch = 1724233283 | ||
end_epoch = 1724233442 | ||
print( | ||
get_cpu_from_monitoring_api( | ||
project_id, | ||
cluster_name, | ||
pod_name, | ||
# container_name, | ||
namespace_name, | ||
start_epoch, | ||
end_epoch, | ||
) | ||
) | ||
|
||
def test_get_memory_from_monitoring_api(self): | ||
project_id = "gcs-fuse-test" | ||
cluster_name = "gargnitin-dryrun-us-west1-6" | ||
pod_name = "fio-tester-gcsfuse-rr-64k-1670041227260535313" | ||
# container_name = "fio-tester" | ||
namespace_name = "default" | ||
start_epoch = 1724233283 | ||
end_epoch = 1724233442 | ||
print( | ||
get_memory_from_monitoring_api( | ||
project_id, | ||
cluster_name, | ||
pod_name, | ||
# container_name, | ||
namespace_name, | ||
start_epoch, | ||
end_epoch, | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |