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

libbeat/cmd/instance: ensure test config file has appropriate permissions #27178

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

kortschak
Copy link
Contributor

@kortschak kortschak commented Aug 2, 2021

This is arguably a bug fix.

What does this PR do?

This change ensures that the test config is owner-exclusive write before running the test. It also adds checks to currently ineffective error assignments.

Why is it important?

Git does not store r/w permissions, instead depending on the host system's umask. On some systems the default umask is 0o002, meaning that the test config file is checked out with g+w permission, causing the test to fail.

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.

Author's Checklist

  • Standard testing

How to test this PR locally

Run go test in github.com/elastic/beats/libbeat/cmd/instance.

Related issues

No related issues.

Use cases

Feature: Test initializing kibana config on system with permissive umask

    Scenario Outline: A contributor runs the test suite on the beats repository
        Given a host environment with a umask that is <umask>
        And the contributor clones github.com/elastic/beats
        Then the beats beats/libbeat/cmd/instance.TestInitKibanaConfig test will pass

    Examples:
        | umask |
        | 0o000 |
        | 0o002 |
        | 0o022 |

Screenshots

N/A

Logs

N/A

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 2, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 2, 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-09-07T21:37:54.474+0000

  • Duration: 150 min 26 sec

  • Commit: cd1d8c0

Test stats 🧪

Test Results
Failed 0
Passed 53881
Skipped 5324
Total 59205

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 53881
Skipped 5324
Total 59205

@mtojek
Copy link
Contributor

mtojek commented Aug 2, 2021

/test

@mtojek mtojek added the Team:Integrations Label for the Integrations team label Aug 3, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 3, 2021
@mtojek mtojek added the needs_backport PR is waiting to be backported to other branches. label Aug 3, 2021
@mergify
Copy link
Contributor

mergify bot commented Aug 30, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b kibanatest_go-w upstream/kibanatest_go-w
git merge upstream/master
git push upstream kibanatest_go-w

@marc-gr marc-gr added backport-v7.15.0 Automated backport with mergify backport-v7.16.0 Automated backport with mergify and removed needs_backport PR is waiting to be backported to other branches. labels Sep 7, 2021
@efd6
Copy link
Contributor

efd6 commented Sep 7, 2021

/test

…ions

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.
@efd6 efd6 merged commit 627b7a8 into elastic:master Sep 8, 2021
mergify bot pushed a commit that referenced this pull request Sep 8, 2021
…ions (#27178)

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.

(cherry picked from commit 627b7a8)
mergify bot pushed a commit that referenced this pull request Sep 8, 2021
…ions (#27178)

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.

(cherry picked from commit 627b7a8)

# Conflicts:
#	libbeat/cmd/instance/beat_test.go
mdelapenya added a commit to mdelapenya/beats that referenced this pull request Sep 9, 2021
* master: (39 commits)
  [Heartbeat] Move JSON tests from python->go (elastic#27816)
  docs: simplify permissions for Dockerfile COPY (elastic#27754)
  Osquerybeat: Fix osquery logger plugin severy levels mapping (elastic#27789)
  [Filebeat] Update compatibility function to remove processor description on ES < 7.9.0 (elastic#27774)
  warn log entry and no validation failure when both queue_url and buck… (elastic#27612)
  libbeat/cmd/instance: ensure test config file has appropriate permissions (elastic#27178)
  [Heartbeat] Add httpcommon options to ZipURL (elastic#27699)
  Add a header round tripper option to httpcommon (elastic#27509)
  [Elastic Agent] Add validation to ensure certificate paths are absolute. (elastic#27779)
  Rename dashboards according to module.yml files for master (elastic#27749)
  Refactor vagrantfile, add scripts for provisioning with docker/kind (elastic#27726)
  Accept syslog dates with leading 0 (elastic#27775)
  [Filebeat] Add timezone config option to decode_cef and syslog input (elastic#27727)
  [Filebeat] Threatintel compatibility updates (elastic#27323)
  Add support for ephemeral containers in elastic agent dynamic provider (elastic#27707)
  [Filebeat] Integration tests in CI for AWS-S3 input (elastic#27491)
  Fix flakyness of TestFilestreamEmptyLine (elastic#27705)
  [Filebeat] kafka v2 using parsers (elastic#27335)
  Update Kafka version parsing / supported range (elastic#27720)
  Update Sarama to 1.29.1 (elastic#27717)
  ...
efd6 pushed a commit that referenced this pull request Sep 9, 2021
…ions (#27178) (#27796)

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.

(cherry picked from commit 627b7a8)

Co-authored-by: Dan Kortschak <[email protected]>
efd6 added a commit that referenced this pull request Sep 13, 2021
… has appropriate permissions (#27797)

* libbeat/cmd/instance: ensure test config file has appropriate permissions (#27178)

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.

(cherry picked from commit 627b7a8)

# Conflicts:
#	libbeat/cmd/instance/beat_test.go

* libbeat/cmd/instance: resolve backport conflict

Co-authored-by: Dan Kortschak <[email protected]>
Co-authored-by: Dan Kortschak <[email protected]>
Icedroid pushed a commit to Icedroid/beats that referenced this pull request Nov 1, 2021
…ions (elastic#27178)

Git does not store r/w permissions, instead depending on the host system's
umask. On some systems the default umask is 0o002, meaning that the test
config file is checked out with g+w permission, causing the test to fail.

This change ensures that the test config is owner-exclusive write before
running the test. It also adds checks to currently ineffective error
assignments.
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 Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants