Skip to content

Conversation

asklymenko
Copy link

Description of the issue

The build process fails on tests if run as root. The non-root build works correctly.

Platform: Debian 12

Steps to reproduce:

  1. Login as root (or any other user with id=0). Clone code
  2. Run: make clean test check_secrets amazon-cloudwatch-agent-linux package-deb

It fail with following errors:

    useragent_test.go:132: 
        	Error Trace:	/build/src/amazon-cloudwatch-agent/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:132
        	Error:      	"map[nop:{}]" should have 2 item(s), but has 1
        	Test:       	TestEmf
    useragent_test.go:136: 
        	Error Trace:	/build/src/amazon-cloudwatch-agent/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:136
        	Error:      	Not equal: 
        	            	expected: "inputs:(nop run_as_user)"
        	            	actual  : "inputs:(nop)"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-inputs:(nop run_as_user)
        	            	+inputs:(nop)
        	Test:       	TestEmf
--- FAIL: TestSetComponentsEmpty (0.00s)
    useragent_test.go:82: 
        	Error Trace:	/build/src/amazon-cloudwatch-agent/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:82
        	Error:      	"map[]" should have 1 item(s), but has 0
        	Test:       	TestSetComponentsEmpty
    useragent_test.go:86: 
        	Error Trace:	/build/src/amazon-cloudwatch-agent/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:86
        	Error:      	Not equal: 
        	            	expected: "inputs:(run_as_user)"
        	            	actual  : ""
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-inputs:(run_as_user)
        	            	+
        	Test:       	TestSetComponentsEmpty

Description of changes

It checks whether 'ua.input' is empty.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Test finished successfully.

Requirements

Before commiting your code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

Integration Tests

To run integration tests against this PR, add the ready for testing label.

@asklymenko asklymenko requested a review from a team as a code owner September 1, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant