Skip to content

test_cpu_mem_from_psutil fails on single-CPU systems #2612

@sanvila

Description

@sanvila

Hello.

When I try to build (the Debian package of) this project (version 6.25.0) on AWS machines of type m7a.medium or r7a.medium, which incidentally have a single CPU, I always (i.e. every time I try) get this:

=================================== FAILURES ===================================
___________________________ test_cpu_mem_from_psutil ___________________________

elasticapm_client = <tests.fixtures.TempStoreClient object at 0x7f6ed00a8aa0>

    def test_cpu_mem_from_psutil(elasticapm_client):
        metricset = cpu_psutil.CPUMetricSet(MetricsRegistry(elasticapm_client))
        # do something that generates some CPU load
        for i in range(10**6):
            j = i * i
        data = next(metricset.collect())
        # we can't really test any specific values here as it depends on the system state.
        # Mocking is also not really a viable choice, as we would then lose the "integration testing"
        # nature of this test with different versions of psutil
>       assert 0 < data["samples"]["system.cpu.total.norm.pct"]["value"] < 1
E       assert 1.0 < 1

tests/metrics/cpu_psutil_tests.py:50: AssertionError

To reproduce I suggest configuring GRUB with GRUB_CMDLINE_LINUX="nr_cpus=1".
If that does not work I can offer a VM where this happens all the time.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions