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

feat: add a mage command to package system tests #27295

Merged
merged 5 commits into from
Aug 23, 2021

Conversation

mdelapenya
Copy link
Contributor

What does this PR do?

This PR adds a mage command to package the system tests results. This command is invoked in the CI in the same conditions that in the past.

The command is composed by:

  • a mage packageSystemTests command, plugged into filebeat and metricbeat modules (both OSS and xpack flavours).
  • a Tar method under the commons package, so that it's possible to compress a source directory using TAR+GZIP algorithms, and writing it to the build dir in the root directory of the Beats repository.

Besides that, we are removing a python script that detected the path to the Python system-tests (used in the pipeline to store the folder name in a variable), and we are updating the Jenkins pipeline to call the new build system command instead of the previous script. To keep existing behaviour, that we could consider it wrong and would possible discuss about it in a follow-up issue, we are passing a new argument to the groovy method in the pipeline, representing the directory in which the Beat live (i.e. filebeat, x-pack/filebeat), so that it's possible to run the mage command in the right context.

Why is it important?

In the past, the collection of the system tests results was done at the pipeline level, so developers were not able to reproduce them. With this new command now it's possible to collect them directly from the build system.

For debugging purpose, it will be possible to debug a CI worker, capturing it and executing this command, to verify if the files to be uploaded are there.

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

$ cd filebeat
$ mage pythonIntegTest
$ mage packageSystemTests
>> skipping symlink: build/system-tests/run/test_harvester.Test.test_ignore_symlink/log/symlink.log
>> skipping symlink: build/system-tests/run/test_harvester.Test.test_symlink_and_file/log/symlink.log
>> skipping symlink: build/system-tests/run/test_harvester.Test.test_symlink_rotated/log/symlink.log
>> skipping symlink: build/system-tests/run/test_harvester.Test.test_symlinks_enabled/log/symlink.log
>> skipping symlink: build/system-tests/run/test_harvester.Test.test_truncate/log/symlink.log
>> skipping symlink: build/system-tests/run/test_input.Test.test_skip_symlinks/log/test.log

# checking file system contents
$ find build/system-tests/run -name "*" | wc -l
    3940
    
# checking TAR contents
$ tar -tf ../build/system-tests-filebeat.tar.gz | wc -l
    3934

Expected behaviour: a TAR file in the root's build directory named as the Beat will exist (i.e. ./build/system-tests-filebeat.tar.gz)

Related issues

Use cases

Screenshots

Logs

@mdelapenya mdelapenya self-assigned this Aug 10, 2021
@mdelapenya mdelapenya added the Team:Automation Label for the Observability productivity team label Aug 10, 2021
@mdelapenya mdelapenya requested a review from a team August 10, 2021 12:02
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Aug 10, 2021
@mdelapenya mdelapenya added the build-system Issue or change affecting Mage, Make, or build scripts. label Aug 10, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 10, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-20T14:40:07.538+0000

  • Duration: 144 min 37 sec

  • Commit: 6d165b5

Test stats 🧪

Test Results
Failed 0
Passed 53527
Skipped 5322
Total 58849

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 53527
Skipped 5322
Total 58849

@mdelapenya mdelapenya marked this pull request as ready for review August 12, 2021 10:45
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

Good idea

@mdelapenya mdelapenya requested a review from andrewkroh August 19, 2021 07:31
Co-authored-by: Jaime Soriano Pastor <[email protected]>
@mdelapenya
Copy link
Contributor Author

Waiting on @andrewkroh for final review 🙏

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

I think it's missing an error check, but otherwise LGTM.

@mdelapenya
Copy link
Contributor Author

@jsoriano I'm gonna merge this one, but would like your help with the backports labels first: 7.x, 7.15 and 7.14?

@jsoriano
Copy link
Member

@jsoriano I'm gonna merge this one, but would like your help with the backports labels first: 7.x, 7.15 and 7.14?

I would say to backport this to 7.x and 7.15.

@mdelapenya mdelapenya added backport-v7.14.0 Automated backport with mergify backport-v7.15.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify and removed backport-v7.14.0 Automated backport with mergify labels Aug 23, 2021
@mdelapenya mdelapenya merged commit 7f086e5 into elastic:master Aug 23, 2021
mergify bot pushed a commit that referenced this pull request Aug 23, 2021
* feat: add a mage command to package system tests

* chore: delegate prints to the caller

* chore: do not keep writing tar file in memory

* chore: update comment

Co-authored-by: Jaime Soriano Pastor <[email protected]>

* chore: handle error while traversing the filesystem

Co-authored-by: Jaime Soriano Pastor <[email protected]>
(cherry picked from commit 7f086e5)
mergify bot pushed a commit that referenced this pull request Aug 23, 2021
* feat: add a mage command to package system tests

* chore: delegate prints to the caller

* chore: do not keep writing tar file in memory

* chore: update comment

Co-authored-by: Jaime Soriano Pastor <[email protected]>

* chore: handle error while traversing the filesystem

Co-authored-by: Jaime Soriano Pastor <[email protected]>
(cherry picked from commit 7f086e5)
mdelapenya added a commit that referenced this pull request Aug 24, 2021
* feat: add a mage command to package system tests

* chore: delegate prints to the caller

* chore: do not keep writing tar file in memory

* chore: update comment

Co-authored-by: Jaime Soriano Pastor <[email protected]>

* chore: handle error while traversing the filesystem

Co-authored-by: Jaime Soriano Pastor <[email protected]>
(cherry picked from commit 7f086e5)

Co-authored-by: Manuel de la Peña <[email protected]>
mdelapenya added a commit that referenced this pull request Aug 24, 2021
* feat: add a mage command to package system tests

* chore: delegate prints to the caller

* chore: do not keep writing tar file in memory

* chore: update comment

Co-authored-by: Jaime Soriano Pastor <[email protected]>

* chore: handle error while traversing the filesystem

Co-authored-by: Jaime Soriano Pastor <[email protected]>
(cherry picked from commit 7f086e5)

Co-authored-by: Manuel de la Peña <[email protected]>
Icedroid pushed a commit to Icedroid/beats that referenced this pull request Nov 1, 2021
* feat: add a mage command to package system tests

* chore: delegate prints to the caller

* chore: do not keep writing tar file in memory

* chore: update comment

Co-authored-by: Jaime Soriano Pastor <[email protected]>

* chore: handle error while traversing the filesystem

Co-authored-by: Jaime Soriano Pastor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.15.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify build-system Issue or change affecting Mage, Make, or build scripts. Team:Automation Label for the Observability productivity team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants