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

Filesystem permissions issues of the Ubuntu Unit Tests #37838

Closed
sharbuz opened this issue Feb 2, 2024 · 2 comments
Closed

Filesystem permissions issues of the Ubuntu Unit Tests #37838

sharbuz opened this issue Feb 2, 2024 · 2 comments
Assignees
Labels
failed-test indicates a failed automation test relates Metricbeat Metricbeat needs_team Indicates that the issue/PR needs a Team:* label

Comments

@sharbuz
Copy link
Contributor

sharbuz commented Feb 2, 2024

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/

@sharbuz sharbuz added Metricbeat Metricbeat failed-test indicates a failed automation test relates labels Feb 2, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 2, 2024
@botelastic
Copy link

botelastic bot commented Feb 2, 2024

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

@oakrizan
Copy link
Contributor

oakrizan commented Jul 31, 2024

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

func TestNewModulesCallModuleFactory(t *testing.T) {
logp.TestingSetup()
r := NewRegister()
r.MustAddMetricSet("foo", "bar", newMetricSetWithOption)
r.SetSecondarySource(NewLightModulesSource("testdata/lightmodules"))
called := false
r.AddModule("foo", func(base BaseModule) (Module, error) {
called = true
return DefaultModuleFactory(base)
})
config, err := conf.NewConfigFrom(mapstr.M{"module": "service"})
require.NoError(t, err)
_, _, err = NewModule(config, r)
assert.NoError(t, err)
assert.True(t, called, "module factory must be called if registered")
}

TestProcessorsForMetricSet_ProcessorsRead
func TestProcessorsForMetricSet_ProcessorsRead(t *testing.T) {
r := NewRegister()
source := NewLightModulesSource("testdata/lightmodules")
procs, err := source.ProcessorsForMetricSet(r, "unpack", "withprocessors")
require.NoError(t, err)
require.NotNil(t, procs)
require.Len(t, procs.List, 1)
}

Closing the issue, since is not actual anymore.

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 Metricbeat Metricbeat needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

No branches or pull requests

2 participants