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

Metricbeat: test_filesystem fails on macOS #37686

Open
2 tasks
sharbuz opened this issue Jan 22, 2024 · 3 comments
Open
2 tasks

Metricbeat: test_filesystem fails on macOS #37686

sharbuz opened this issue Jan 22, 2024 · 3 comments
Labels
failed-test indicates a failed automation test relates macOS Enable builds in the CI for darwin testing Metricbeat Metricbeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@sharbuz
Copy link
Contributor

sharbuz commented Jan 22, 2024

Flaky Test

  • Test Name: test_filesystem (metricbeat/module/system/test_system.py)
    Link:
    @unittest.skipUnless(re.match("(?i)win|linux|darwin|freebsd|openbsd", sys.platform), "os")
    def test_filesystem(self):
    """
    Test system/filesystem output.
    """
    self.render_config_template(modules=[{
    "name": "system",
    "metricsets": ["filesystem"],
    "period": "5s",
    # prevent permissions issues on systems with docker
    "extras": {
    "filesystem.ignore_types": ["nsfs",
    "sysfs", "tmpfs", "bdev", "proc", "cgroup", "cgroup2", "cpuset",
    "devtmpfs", "configfs", "debugfs", "tracefs", "securityfs", "sockfs",
    "bpf", "pipefs", "ramfs", "hugetlbfs", "devpts", "autofs", "efivarfs",
    "mqueue", "selinuxfs", "binder", "pstore", "fuse", "fusectl", "rpc_pipefs",
    "overlay", "binfmt_misc", "unavailable"],
    }
    }])
    self.run_beat_and_stop()
    output = self.read_output_json()
    self.assertGreater(len(output), 0)
    for evt in output:
    self.assert_fields_are_documented(evt)
    filesystem = evt["system"]["filesystem"]
    self.assert_fields_for_platform(SYSTEM_FILESYSTEM, filesystem)
  • Branch:
    -- main: Enable tests that were muted during migration #40387
    -- 7.17: Enable tests that were muted during migration 7.17 #40398

NB! tests should be enabled back, since those were muted while migrating from Jenkins to Buildkite. Please check changed files in mentioned PRs:
-- metricbeat/module/system/test_system.py
-- metricbeat/tests/system/test_reload.py

Stack Trace

=================================== FAILURES ===================================
_____________________________ Test.test_filesystem _____________________________
self = <test_system.Test testMethod=test_filesystem>
    @unittest.skipUnless(re.match("(?i)win|linux|darwin|freebsd|openbsd", sys.platform), "os")
    def test_filesystem(self):
        """
        Test system/filesystem output.
        """
        self.render_config_template(modules=[{
            "name": "system",
            "metricsets": ["filesystem"],
            "period": "5s",
            # prevent permissions issues on systems with docker
            "extras": {
                "filesystem.ignore_types": ["nsfs",
                                            "sysfs", "tmpfs", "bdev", "proc", "cgroup", "cgroup2", "cpuset",
                                            "devtmpfs", "configfs", "debugfs", "tracefs", "securityfs", "sockfs",
                                            "bpf", "pipefs", "ramfs", "hugetlbfs", "devpts", "autofs", "efivarfs",
                                            "mqueue", "selinuxfs", "binder", "pstore", "fuse", "fusectl", "rpc_pipefs",
                                            "overlay", "binfmt_misc", "unavailable"],
            }
        }])
        self.run_beat_and_stop()
        output = self.read_output_json()
        self.assertGreater(len(output), 0)
        for evt in output:
            self.assert_fields_are_documented(evt)
            filesystem = evt["system"]["filesystem"]
>           self.assert_fields_for_platform(SYSTEM_FILESYSTEM, filesystem)
module/system/test_system.py:288:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/system/metricbeat.py:74: in assert_fields_for_platform
    self.assertCountEqual(self.de_dot(
E   AssertionError: Element counts were not equal:
E   First has 1, Second has 0:  'options'

Tasks

Preview Give feedback
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 22, 2024
@sharbuz sharbuz added the macOS Enable builds in the CI for darwin testing label Jan 22, 2024
@pazone
Copy link
Contributor

pazone commented Jan 22, 2024

Looks like merticbeat iterates over all mounted disks and gets their filesystem info.
The test expects the field options to be present in the metricbeat filesystem json output for each of the disks.
After BK agent migration to MacOS 13(Orka) the option field is not available on one(or more) mounted disks.
Is the options field critical? The fields.yml says it represents The options present on the filesystem mount.
The example output doesn't contain the options field. I might be wrong but that makes me think that the options field is optional.
As a quick solution, we can exclude the options from the list of mandatory fields for MacOS.
Alternatively, we can try to understand which disk doesn't contain any options and try to ignore/remove it.

@sharbuz sharbuz added the failed-test indicates a failed automation test relates label Feb 2, 2024
@oakrizan oakrizan changed the title MacOS unit-test fails on the filesystem check. Metricbeat: test_filesystem fails on macOS Jul 31, 2024
@oakrizan oakrizan added the Metricbeat Metricbeat label Jul 31, 2024
@ycombinator ycombinator added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Aug 13, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 13, 2024
@rowlandgeoff
Copy link
Contributor

During the migration of beats-ci from Jenkins to Buildkite, a number of tests were failing consistently due to issues unrelated to the migration. Those tests were disabled to stabilize the CI, with the intent to revisit them post-migration. @oakrizan has reviewed them all in her draft PRs linked above in the description, and has opened tickets such as this one to highlight to the product teams the tests that are currently still disabled and could use some attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed-test indicates a failed automation test relates macOS Enable builds in the CI for darwin testing Metricbeat Metricbeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

6 participants