Skip to content

Commit

Permalink
tests: adapt e2e tests to evt.args format change
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 committed Apr 15, 2024
1 parent 78ddec6 commit d2900ce
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_db_program_spawned_process(sinsp, run_containers: dict):
},
{
"container.id": generator_id,
"evt.args": "filename=/bin/ls ",
"evt.args": "filename=/bin/ls",
"evt.category": "process",
"evt.num": SinspField.numeric_field(),
"evt.time": SinspField.numeric_field(),
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/tests/test_event_generator/test_make_binary_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_make_binary_dirs(sinsp, run_containers: dict):
"thread.tid": SinspField.numeric_field()
},
{
"evt.args": "res=0 dirfd=-100(AT_FDCWD) path=/bin/directory-created-by-event-generator mode=1ED ",
"evt.args": "res=0 dirfd=-100(AT_FDCWD) path=/bin/directory-created-by-event-generator mode=1ED",
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand All @@ -55,7 +55,7 @@ def test_make_binary_dirs(sinsp, run_containers: dict):
"thread.tid": SinspField.numeric_field()
},
{
"evt.args": "res=-21(EISDIR) dirfd=-100(AT_FDCWD) name=/bin/directory-created-by-event-generator flags=0 ",
"evt.args": "res=-21(EISDIR) dirfd=-100(AT_FDCWD) name=/bin/directory-created-by-event-generator flags=0",
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand All @@ -75,7 +75,7 @@ def test_make_binary_dirs(sinsp, run_containers: dict):
"thread.tid": SinspField.numeric_field()
},
{
"evt.args": "res=0 dirfd=-100(AT_FDCWD) name=/bin/directory-created-by-event-generator flags=512(AT_REMOVEDIR) ",
"evt.args": "res=0 dirfd=-100(AT_FDCWD) name=/bin/directory-created-by-event-generator flags=512(AT_REMOVEDIR)",
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_modify_binary_dirs(sinsp, run_containers: dict):
"thread.tid": SinspField.numeric_field()
},
{
"evt.args": "res=0 olddirfd=-100(AT_FDCWD) oldpath=/bin/true newdirfd=-100(AT_FDCWD) newpath=/bin/true.event-generator ",
"evt.args": "res=0 olddirfd=-100(AT_FDCWD) oldpath=/bin/true newdirfd=-100(AT_FDCWD) newpath=/bin/true.event-generator",
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand All @@ -55,7 +55,7 @@ def test_modify_binary_dirs(sinsp, run_containers: dict):
"thread.tid": SinspField.numeric_field()
},
{
"evt.args": "res=0 olddirfd=-100(AT_FDCWD) oldpath=/bin/true.event-generator newdirfd=-100(AT_FDCWD) newpath=/bin/true ",
"evt.args": "res=0 olddirfd=-100(AT_FDCWD) oldpath=/bin/true.event-generator newdirfd=-100(AT_FDCWD) newpath=/bin/true",
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_network_activity(sinsp, run_containers: dict):
expected_events = [
{
"container.id": generator_id,
"evt.args": "fd=3(<4>) addr=10.2.3.4:8192 ",
"evt.args": "fd=3(<4>) addr=10.2.3.4:8192",
"evt.category": "net",
"evt.num": SinspField.numeric_field(),
"evt.time": SinspField.numeric_field(),
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/tests/test_event_generator/test_non_sudo_setuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ def test_non_sudo_setuid(sinsp, run_containers):

expected_events = [
{
"evt.args": "uid=2(<NA>) ",
"evt.args": "uid=2(<NA>)",
"evt.dir": ">",
"evt.type": "setuid",
"proc.name": "child",
},
{
"evt.args": "res=0 ",
"evt.args": "res=0",
"evt.dir": "<",
"evt.type": "setuid",
"proc.name": "child",
},
{
"evt.args": "uid=0(<NA>) ",
"evt.args": "uid=0(<NA>)",
"evt.dir": ">",
"evt.type": "setuid",
"proc.name": "child",
},
{
"evt.args": "res=-1(EPERM) ",
"evt.args": "res=-1(EPERM)",
"evt.dir": "<",
"evt.type": "setuid",
"proc.name": "child",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_read_sensitive_file(sinsp, run_containers: dict, expected_process: str)

expected_events = [
{
"evt.args": SinspField.regex_field(r'fd=3\(<f>/etc/shadow\) dirfd=-100\(AT_FDCWD\) name=/etc/shadow flags=4097\(O_RDONLY|O_CLOEXEC\) mode=0 dev=\W+ ino=\d+ '),
"evt.args": SinspField.regex_field(r'fd=3\(<f>/etc/shadow\) dirfd=-100\(AT_FDCWD\) name=/etc/shadow flags=4097\(O_RDONLY|O_CLOEXEC\) mode=0 dev=\W+ ino=\d+'),
"evt.cpu": SinspField.numeric_field(),
"evt.dir": "<",
"evt.num": SinspField.numeric_field(),
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/tests/test_network/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,61 +32,61 @@ def expected_events(origin: dict, destination: dict) -> list:
return [
{
"container.id": origin['id'],
"evt.args": "domain=2(AF_INET) type=1 proto=0 ",
"evt.args": "domain=2(AF_INET) type=1 proto=0",
"evt.category": "net",
"evt.type": "socket",
"fd.name": None,
"proc.cmdline": f"curl --local-port {origin['local_port']} {destination['ip']}",
"proc.exe": "curl",
}, {
"container.id": origin['id'],
"evt.args": "fd=3(<4>) ",
"evt.args": "fd=3(<4>)",
"evt.category": "net",
"evt.type": "socket",
"fd.name": "",
"proc.cmdline": f"curl --local-port {origin['local_port']} {destination['ip']}",
"proc.exe": "curl",
}, {
"container.id": origin['id'],
"evt.args": f"fd=3(<4t>0.0.0.0:{origin['local_port']}) addr={destination['ip']} ",
"evt.args": f"fd=3(<4t>0.0.0.0:{origin['local_port']}) addr={destination['ip']}",
"evt.category": "net",
"evt.type": "connect",
"fd.name": f"0.0.0.0:{origin['local_port']}",
"proc.cmdline": f"curl --local-port {origin['local_port']} {destination['ip']}",
"proc.exe": "curl",
}, {
"container.id": destination['id'],
"evt.args": "flags=0 ",
"evt.args": "flags=0",
"evt.category": "net",
"evt.type": "accept4",
"fd.name": None,
"proc.cmdline": "nginx",
"proc.exe": "nginx: master proces",
}, {
"container.id": destination['id'],
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']}) tuple={origin['ip']}->{destination['ip']} queuepct=0 queuelen=0 queuemax=511 ",
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']}) tuple={origin['ip']}->{destination['ip']} queuepct=0 queuelen=0 queuemax=511",
"evt.category": "net",
"evt.type": "accept4",
"fd.name": f"{origin['ip']}->{destination['ip']}",
"proc.cmdline": "nginx",
"proc.exe": "nginx: master proces",
}, {
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']}) ",
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']})",
"evt.dir": ">",
"evt.type": "close",
"proc.name": "curl",
}, {
"evt.args": "res=0 ",
"evt.args": "res=0",
"evt.dir": "<",
"evt.type": "close",
"proc.name": "curl",
}, {
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']}) ",
"evt.args": f"fd=3(<4t>{origin['ip']}->{destination['ip']})",
"evt.dir": ">",
"evt.type": "close",
"proc.name": "nginx",
}, {
"evt.args": "res=0 ",
"evt.args": "res=0",
"evt.dir": "<",
"evt.type": "close",
"proc.name": "nginx",
Expand Down

0 comments on commit d2900ce

Please sign in to comment.