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

Report job timeouts as FAIL #350

Merged
merged 4 commits into from
Nov 27, 2023
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
2 changes: 1 addition & 1 deletion container_files/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM fedora:36
FROM fedora:39

RUN dnf install -y initscripts \
iputils \
Expand Down
5 changes: 3 additions & 2 deletions lnst/Agent/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[email protected] (Jiri Pirko)
"""

import importlib.machinery
import signal
import logging
import os, stat
Expand All @@ -19,7 +20,6 @@
import socket
import ctypes
import multiprocessing
import imp
import types
from time import sleep
from inspect import isclass
Expand Down Expand Up @@ -161,7 +161,8 @@ def load_cached_module(self, module_name, res_hash):
if module_name in self._dynamic_modules:
return
module_path = self._cache.get_path(res_hash)
module = imp.load_source(module_name, module_path)
module_loader = importlib.machinery.SourceFileLoader(module_name, module_path)
module = module_loader.load_module()
self._dynamic_modules[module_name] = module

def init_cls(self, cls_name, module_name, args, kwargs):
Expand Down
13 changes: 6 additions & 7 deletions lnst/Agent/Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@ def kill(self, sig=signal.SIGKILL):
os.killpg(self._pid, sig)

if sig == signal.SIGKILL:
self.set_finished(dict(type = "job_finished",
job_id = self._id,
result = dict(passed = False,
res_data = "Job killed",
type = "result")))

send_data(self._child_pipe, self.get_result())
result = dict(type = "job_finished",
job_id = self._id,
result = dict(passed = False,
res_data = "Job killed",
type = "result"))
send_data(self._child_pipe, result)
return True
except OSError as exc:
logging.error(str(exc))
Expand Down
44 changes: 28 additions & 16 deletions lnst/Recipes/ExampleRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,33 @@ def test(self):
self.matched.m1.eth0.up()
self.matched.m2.eth0.ip_add(ipaddress("192.168.1.2/24"))
self.matched.m2.eth0.up()
ping_job = self.matched.m1.run(Ping(dst=self.matched.m2.eth0,
interval=0,
iface=self.matched.m1.eth0))

netserver_job = self.matched.m1.run(Netserver(bind=self.matched.m1.eth0),
bg=True)

netperf_job = self.matched.m2.run(Netperf(server=self.matched.m1.eth0,
duration=1,
confidence="99,5",
runs="5",
debug=0,
max_deviation={'type':"percent",
'value':20.0},
testname="TCP_STREAM"))

self.matched.m1.run(
Ping(
dst="192.168.1.2/24",
interface=self.matched.m1.eth0,
)
)

netserver_job = self.matched.m1.run(
Netserver(bind="192.168.1.1/24"),
bg=True,
)

self.matched.m2.run(
Netperf(
server="192.168.1.1/24",
duration=1,
confidence="99,5",
runs="5",
debug=0,
max_deviation={
'type':"percent",
'value':20.0,
},
testname="TCP_STREAM",
)
)

netserver_job.kill(signal=signal.SIGINT)

Expand Down Expand Up @@ -117,7 +129,7 @@ def test(self):
self.matched.m1.run("ip a")
m1.vxlan0.destroy()

ctl = Controller(debug=1)
ctl = Controller(debug=True)

r = MyRecipe()
ctl.run(r, allow_virt=True)
Expand Down
Loading