| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,6 +104,10 @@ def parse_args(args: List[str]) -> argparse.Namespace: | |||
| 104 | 104 | "container", | |
| 105 | 105 | help="The container to wait for", | |
| 106 | 106 | ) | |
| 107 | + parser_log = subparsers.add_parser("logs", help="Dump teuthology logs") | ||
| 108 | + parser_log.add_argument("--run-name", type=str, default=None) | ||
| 109 | + parser_log.add_argument("--job-id", type=str, default=None) | ||
| 110 | + parser_log.add_argument("--locate", action=argparse.BooleanOptionalAction) | ||
| 107 | 111 | return parser.parse_args(args) | |
| 108 | 112 | ||
| 109 | 113 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,10 @@ async def run(): | |||
| 40 | 40 | return | |
| 41 | 41 | elif args.command == "wait": | |
| 42 | 42 | return await obj.wait(container_name=args.container) | |
| 43 | + elif args.command == "logs": | ||
| 44 | + return await obj.logs( | ||
| 45 | + run_name=args.run_name, job_id=args.job_id, locate=args.locate | ||
| 46 | + ) | ||
| 43 | 47 | else: | |
| 44 | 48 | await obj.apply(args.command) | |
| 45 | 49 | return 0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,8 @@ | |||
| 4 | 4 | import tempfile | |
| 5 | 5 | import random as rd | |
| 6 | 6 | from datetime import datetime, timedelta | |
| 7 | - import unittest | ||
| 7 | + | ||
| 8 | + import pytest | ||
| 8 | 9 | ||
| 9 | 10 | from ceph_devstack import config | |
| 10 | 11 | from ceph_devstack.resources.ceph.utils import ( | |
@@ -16,7 +17,7 @@ | |||
| 16 | 17 | from ceph_devstack.resources.ceph import CephDevStack | |
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | - class TestDevStack(unittest.IsolatedAsyncioTestCase): | ||
| 20 | + class TestDevStack: | ||
| 20 | 21 | def test_get_logtimestamp(self): | |
| 21 | 22 | dirname = "root-2025-03-20_18:34:43-orch:cephadm:smoke-small-main-distro-default-testnode" | |
| 22 | 23 | assert get_logtimestamp(dirname) == datetime(2025, 3, 20, 18, 34, 43) | |
@@ -39,12 +40,12 @@ def test_get_job_id_returns_job_on_unique_job(self): | |||
| 39 | 40 | ||
| 40 | 41 | def test_get_job_id_throws_filenotfound_on_missing_job(self): | |
| 41 | 42 | jobs = [] | |
| 42 | - with self.assertRaises(FileNotFoundError): | ||
| 43 | + with pytest.raises(FileNotFoundError): | ||
| 43 | 44 | get_job_id(jobs) | |
| 44 | 45 | ||
| 45 | 46 | def test_get_job_id_throws_toomanyjobsfound_on_more_than_one_job(self): | |
| 46 | 47 | jobs = ["1", "2"] | |
| 47 | - with self.assertRaises(TooManyJobsFound): | ||
| 48 | + with pytest.raises(TooManyJobsFound): | ||
| 48 | 49 | get_job_id(jobs) | |
| 49 | 50 | ||
| 50 | 51 | async def test_logs_command_display_log_file_of_latest_run(self): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments