Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disable trace from command line #34

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ that should be excluded from the execution; if both include and exclude match
a test, the test will not be run
* `-n|--no-delete` - do not delete the resources after run (**NOTICE**: you
will have to manually delete both containers and networks)
* `-x|--no-trace` - do not trace call
* `-v|--version` - prints the current version

### Scenarios
Expand Down
1 change: 1 addition & 0 deletions sipssert/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, args):
tests_filters.ParseTestsFilters(exclude_filters))
self.logs_dir = args.logs_dir
self.no_delete = args.no_delete
self.no_trace = args.no_trace
current_date = datetime.now().strftime("%Y-%m-%d.%H:%M:%S.%f")
self.run_logs_dir = os.path.join(self.logs_dir, current_date)
self.link_file = os.path.join(self.logs_dir, "latest")
Expand Down
5 changes: 5 additions & 0 deletions sipssert/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
default=False,
action='store_true')

arg_parser.add_argument('-x', '--no-trace',
help='Do not trace call',
default=False,
action='store_true')

arg_parser.add_argument('-v', '--version',
action='version',
help='Returns the version of the tool',
Expand Down
10 changes: 7 additions & 3 deletions sipssert/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def __init__(self, scenario_file, controller, test_set, set_logs_dir, set_defaul
nets = self.networks if self.networks else []
if self.network:
nets.append(self.network)
self.tracer = tracer.Tracer(self.scen_logs_dir, "capture", nets, self.name)
self.no_trace = self.controller.no_trace
if not self.no_trace:
self.tracer = tracer.Tracer(self.scen_logs_dir, "capture", nets, self.name)
self.timeout = self.config.get("timeout", 0)
container_prefix = f"{test_set.name}/{self.name}"
self.tasks = tasks_list.TasksList("tasks", self.dirname, self.scen_logs_dir,
Expand All @@ -81,7 +83,8 @@ def run(self):
"""Runs a scenario with all its prerequisits"""
start_time = time.time()
self.tlogger.test_start(self.name)
self.tracer.start()
if not self.no_trace:
self.tracer.start()
try:
self.init_tasks.run()
try:
Expand All @@ -94,7 +97,8 @@ def run(self):
self.cleanup_tasks.run(force_all=True)
except Exception:
logger.slog.exception("Error occured during cleanup task")
self.tracer.stop()
if not self.no_trace:
self.tracer.stop()
logger.slog.debug("scenario executed in {:.3f}s".format(time.time() - start_time))
self.tlogger.status(self.tasks.status)

Expand Down
Loading