Skip to content

possible error in test_perf.py test (or in my setup..?) #3430

@axodentally

Description

@axodentally

When trying to build glances, the test_perf.py test fails every time with this error:

Details
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
            glances_stats.update()
            # interrupts_gauge should always increase
            interrupts_gauge = glances_stats.get_plugin('cpu').get_raw().get('interrupts_gauge')
            if interrupts_gauge is not None:
                if interrupts_gauge == previous_interrupts_gauge:
                    from_cache += 1
                else:
                    from_update += 1
                    previous_interrupts_gauge = interrupts_gauge
            counter += 1
        print(f"{counter} iterations. From cache: {from_cache} | From update: {from_update}")
        assert counter > test_duration
        assert from_update < from_cache
        assert from_cache >= test_duration * 2
>       assert from_update >= (test_duration / 2) - 1
E       assert 3 >= ((12 / 2) - 1)

tests/test_perf.py:40: AssertionError
        from_cache = 0
        from_update = 0
        previous_interrupts_gauge = None
        while not perf_timer.finished():
            glances_stats.update()
            # interrupts_gauge should always increase
            interrupts_gauge = glances_stats.get_plugin('cpu').get_raw().get('interrupts_gauge')
            if interrupts_gauge is not None:
                if interrupts_gauge == previous_interrupts_gauge:
                    from_cache += 1
                else:
                    from_update += 1
                    previous_interrupts_gauge = interrupts_gauge
            counter += 1
        print(f"{counter} iterations. From cache: {from_cache} | From update: {from_update}")
        assert counter > test_duration
        assert from_update < from_cache
        assert from_cache >= test_duration * 2
>       assert from_update >= (test_duration / 2) - 1
E       assert 3 >= ((12 / 2) - 1)

tests/test_perf.py:40: AssertionError
------------------------------ Captured log setup ------------------------------
INFO     root:config.py:177 Read configuration file './conf/glances.conf'
INFO     root:__init__.py:231 Followings processes stats wil not be displayed: cpu_num
----------------------------- Captured stdout call -----------------------------
69 iterations. From cache: 62 | From update: 3
------------------------------ Captured log call -------------------------------
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2146304, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2150400, 196608, 2146304, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [3186688, 15609856, 3186688, 15609856, 1]
INFO     root:processes.py:777 *** Sort by cpu_times called <class 'list'> [196608, 2158592, 196608, 2150400, 1]
=============================== warnings summary ===============================
tests/test_core.py: 71 warnings
  /nix/store/slhpx9glq7vl99bwi93bgrhn3syv98s1-python3-3.13.11/lib/python3.13/multiprocessing/popen_fork.py:67: DeprecationWarning: This process (p>
    self.pid = os.fork()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_api.py::test_glances_api_plugin_network - assert 0 > 0
FAILED tests/test_perf.py::test_perf_update - assert 3 >= ((12 / 2) - 1)
===== 2 failed, 377 passed, 9 deselected, 71 warnings in 79.49s (0:01:19) ======

i don't get the from_update assertion here, that needs to be bigger that (12 / 2) - 1 and is always 3 in my case. I do not know if this is an error in the test or in my build environment, so any help is appreciated!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions