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

Filesystem permissions issues of the Ubuntu Unit Tests #37838

Closed sharbuz closed 2 months ago

sharbuz commented 8 months ago

The issue was found during the pipeline's migration process from Jenkins to Buildkite. Example of the error: https://buildkite.com/elastic/beats-metricbeat/builds/1154#018d12db-dc0c-4bcd-b9b4-d5dece0b42c6/272-1267

=== FAIL: metricbeat/mb TestNewModulesCallModuleFactory (0.00s)
    lightmodules_test.go:399:
            Error Trace:    /opt/buildkite-agent/builds/bk-agent-prod-gcp-1705418421998491635/elastic/beats-metricbeat/metricbeat/mb/lightmodules_test.go:399
            Error:          Received unexpected error:
                            no metricsets configured for module 'service'
            Test:           TestNewModulesCallModuleFactory
    lightmodules_test.go:401:
            Error Trace:    /opt/buildkite-agent/builds/bk-agent-prod-gcp-1705418421998491635/elastic/beats-metricbeat/metricbeat/mb/lightmodules_test.go:401
            Error:          Should be true
            Test:           TestNewModulesCallModuleFactory
            Messages:       module factory must be called if registered
=== FAIL: metricbeat/mb TestProcessorsForMetricSet_ProcessorsRead (0.00s)
    lightmodules_test.go:424:
            Error Trace:    /opt/buildkite-agent/builds/bk-agent-prod-gcp-1705418421998491635/elastic/beats-metricbeat/metricbeat/mb/lightmodules_test.go:424
            Error:          Received unexpected error:
                            reading processors for metricset 'withprocessors' in module 'unpack': loading light module 'unpack' definition: loading module configuration from 'testdata/lightmodules/unpack/module.yml': config file ("testdata/lightmodules/unpack/module.yml") can only be writable by the owner but the permissions are "-rw-rw-r--" (to fix the permissions use: 'chmod go-w /opt/buildkite-agent/builds/bk-agent-prod-gcp-1705418421998491635/elastic/beats-metricbeat/metricbeat/mb/testdata/lightmodules/unpack/module.yml')
            Test:           TestProcessorsForMetricSet_ProcessorsRead

Temporary solution:


sudo chmod -R go-w metricbeat/
botelastic[bot] commented 8 months ago

This issue doesn't have a Team:<team> label.

oakrizan commented 2 months ago

After all disabled during migration tests were enabled, double checked if the TestNewModulesCallModuleFactory and TestProcessorsForMetricSet_ProcessorsRead still fail.

Result: Both tests are running successfully and are not disabled. BK build: https://buildkite.com/elastic/beats-metricbeat/builds/8052#019102f4-2835-4274-8869-208cc7d95bad/136-309

ok      github.com/elastic/beats/v7/metricbeat/mb   0.031s  coverage: 81.0% of statements

beats-metricbeat_build_8052_ubuntu-metricbeat-ubuntu-x86-64-unit-tests.log

TestNewModulesCallModuleFactory https://github.com/elastic/beats/blob/49f3efeada111d683754c2615b6af0e847a4c998/metricbeat/mb/lightmodules_test.go#L382-L402 TestProcessorsForMetricSet_ProcessorsRead https://github.com/elastic/beats/blob/49f3efeada111d683754c2615b6af0e847a4c998/metricbeat/mb/lightmodules_test.go#L420-L427

Closing the issue, since is not actual anymore.