amazon-cloudwatch-agent icon indicating copy to clipboard operation
amazon-cloudwatch-agent copied to clipboard

build error: "map[]" should have 1 item(s), but has 0

Open anilsamuel opened this issue 2 months ago • 0 comments

Describe the bug "make clean build release" build command result errors below

ok github.com/aws/amazon-cloudwatch-agent/extension/agenthealth/handler/stats/provider 0.069s coverage: 63.2% of statements --- FAIL: TestSetComponentsEmpty (0.00s) useragent_test.go:84: Error Trace: /work/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:84 Error: "map[]" should have 1 item(s), but has 0 Test: TestSetComponentsEmpty useragent_test.go:88: Error Trace: /work/amazon-cloudwatch-agent/extension/agenthealth/handler/useragent/useragent_test.go:88 Error: Not equal: expected: "inputs:(run_as_user)" actual : ""

                            Diff:
                            --- Expected
                            +++ Actual
                            @@ -1 +1 @@
                            -inputs:(run_as_user)
                            +
            Test:           TestSetComponentsEmpty

FAIL coverage: 58.8% of statements

Steps to reproduce

  1. git clone the repo
  2. Run following commands yum -y install gcc make rpm-build golang git rpmdevtools wget tar gzip wget https://go.dev/dl/go1.24.9.linux-amd64.tar.gz tar -C /usr/local -xzf go1.24.9.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin export GOFLAGS="${GOFLAGS:-} -buildvcs=false" nohup make clean build release > make.log 2>&1

What did you expect to see? Successful build

What did you see instead? Errors during test run

What version did you use? Version: 1.300062.0-6-g3fe9fa5d-untracked

Environment

cat /etc/os-release

NAME="Amazon Linux" VERSION="2023" ID="amzn" ID_LIKE="fedora" VERSION_ID="2023" PLATFORM_ID="platform:al2023" PRETTY_NAME="Amazon Linux 2023.9.20251117" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023" HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/" DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/" SUPPORT_URL="https://aws.amazon.com/premiumsupport/" BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023" VENDOR_NAME="AWS" VENDOR_URL="https://aws.amazon.com/" SUPPORT_END="2029-06-30"

anilsamuel avatar Dec 04 '25 23:12 anilsamuel