elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.15k stars 4.91k forks source link

Metricbeat: test_filesystem fails on macOS #37686

Open sharbuz opened 8 months ago

sharbuz commented 8 months ago

Flaky Test

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
- [ ] Fix MacOS filesystem check
- [ ] Enable the filesystem check for MacOS unit-tests
pazone commented 8 months ago

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.

elasticmachine commented 1 month ago

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

rowlandgeoff commented 1 month ago

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.