falcosecurity / libs

libsinsp, libscap, the kernel module driver, and the eBPF driver sources
https://falcosecurity.github.io/libs/
Apache License 2.0
216 stars 160 forks source link

`e2e` Python libs tests now failing locally #1194

Closed incertum closed 11 months ago

incertum commented 1 year ago

Describe the bug

Noticed that I cannot run the e2e tests anymore locally while it used to work when it was last refactors to support localhost test runs.

self = <sinspqa.sinsp.SinspProcessStreamer object at 0x7f70670b20b0>, process = <sinspqa.sinsp.SinspProcessStreamer object at 0x7f70670b0610>, timeout = 10

    def __init__(self, process: Popen, timeout: int = 10):
        """
        Parameters:
            container (docker.Container): A container object to stream logs from.
            timeout (int): The maximum amount of time the streamer will read logs from the container.
        """
        self.process = process
        self.timeout = timeout
        self.queue = Queue()
        self.stdout_thread = Thread(target=SinspProcessStreamer._readline,
>                                   args=[self.process.stdout, self.queue])
E       AttributeError: 'SinspProcessStreamer' object has no attribute 'stdout'

How to reproduce it

Try running it locally on current master. Does it still work for everyone?

Additional context

@Molter73 if it still works for you, please let me know what additional information you need from me?

Molter73 commented 1 year ago

That doesn't look like an innocent break. Looks like process should be a Popen object but it's getting a SinspProcessStreamer in that parameter (the joys of weakly typed languages!).

I'll look into it, but I find it really odd.

Molter73 commented 1 year ago

After some issues trying to run the tests on Fedora 38 (apparently we are not detecting container ids correctly with podman but I think this may have been a known issue), I gave up, ran the tests on Ubuntu 22.04 and it seems to be working properly.

@incertum, any chance you can send me the full report generated in build/report/? Either by attaching here and/or via DM? That should have everything needed for me to dig a little deeper.

incertum commented 1 year ago

Discussed a bit with Mauro on slack, the problem appears to be running everything as root if you don't run the tests from a container and just on your box and it's looking for the wrong python and wrong installed packages location even if I run it from a fresh venv. We don't have a solution atm, other than a possible major refactor or building everything in a way so it can be run from a compatible container, e.g. using falco-builder container to build sinsp-example and drivers respectively and not use the build/ folder builds.