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

Fix regex to locate elastic-agent .zip packages in package tests #3908

Merged
merged 10 commits into from
Jan 10, 2024

Conversation

pchila
Copy link
Member

@pchila pchila commented Dec 13, 2023

What does this PR do?

This PR fixes the regular expression used to find elastic-agent .zip packages and test them.

Why is it important?

We want to run tests on freshly generated packages

Checklist

  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Author's Checklist

  • [ ]

How to test this PR locally

To test the PR we can add a blatantly wrong assertion like assert.True(t, false) in the checkZip function in package_test.go
and then run

SNAPSHOT=true DEV=true PLATFORMS="windows/amd64" PACKAGES="zip"  mage -v package

Without this fix, the packages tests pass anyways because we are not matching any file.
With the fix we should see a beautiful test failure like this:

=== RUN   TestZip
=== RUN   TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_config_file_permissions
=== RUN   TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_manifest_file_permissions
=== RUN   TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_modules.d_file_permissions
=== RUN   TestZip/License_file_LICENSE.txt
=== RUN   TestZip/License_file_NOTICE.txt
=== NAME  TestZip
    package_test.go:177:
                Error Trace:    /home/paolo/dev/elastic-agent/dev-tools/packaging/package_test.go:177
                                                        /home/paolo/dev/elastic-agent/dev-tools/packaging/package_test.go:91
                Error:          Should be true
                Test:           TestZip
--- FAIL: TestZip (0.01s)
    --- PASS: TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_config_file_permissions (0.00s)
    --- PASS: TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_manifest_file_permissions (0.00s)
    --- PASS: TestZip/elastic-agent-8.13.0-SNAPSHOT-windows-x86_64.zip_modules.d_file_permissions (0.00s)
    --- PASS: TestZip/License_file_LICENSE.txt (0.00s)
    --- PASS: TestZip/License_file_NOTICE.txt (0.00s)
=

Related issues

Use cases

Screenshots

Logs

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@pchila pchila added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing labels Dec 13, 2023
@pchila pchila self-assigned this Dec 13, 2023
@pchila pchila requested a review from a team as a code owner December 13, 2023 20:51
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

mergify bot commented Dec 13, 2023

This pull request does not have a backport label. Could you fix it @pchila? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy paste is to blame for this one I think.

@michalpristas
Copy link
Contributor

Copy paste is to blame for this one I think.

True. Whole dev-tools is a copy paste of the one used in beats

@pchila
Copy link
Member Author

pchila commented Dec 20, 2023

buildkite test this

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@pchila pchila merged commit 8a8fa5d into elastic:main Jan 10, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants