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

Refactor tests in metricbeat in kubernetes module #32706

Merged

Conversation

gsantoro
Copy link
Contributor

What does this PR do?

Refactor tests in metricbeat under the kubernetes module.

Why is it important?

Simplify tests and avoid duplication

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • make sure the tests are passing

@gsantoro gsantoro added enhancement cleanup Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team labels Aug 16, 2022
@gsantoro gsantoro self-assigned this Aug 16, 2022
@gsantoro gsantoro requested review from a team as code owners August 16, 2022 12:38
@gsantoro gsantoro requested review from rdner and faec and removed request for a team August 16, 2022 12:38
@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 16, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 16, 2022

💚 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: 2022-08-18T10:31:10.619+0000

  • Duration: 56 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 3639
Skipped 873
Total 4512

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Aug 16, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @gsantoro? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)
    To fixup this pull request, you need to add the backport labels for the needed
    branches, such as:
  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

"cpu.usage.core.ns": 43959424,
"cpu.usage.nanocores": 11263994,

"logs.available.bytes": int64(98727014400),
"logs.capacity.bytes": int64(101258067968),
"logs.used.bytes": 28672,
Copy link
Contributor

Choose a reason for hiding this comment

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

So you removed them as they are unrleayed with cpu/memory test? I think is better like that

Copy link
Contributor

Choose a reason for hiding this comment

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

it was moved to basicTests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't removed them entirely. I just moved into a function basicTests since they were not related to cpu/memory and in case we wanted to add more tests in the future. pod_test.go is a good example of why it makes sense to move those fields in a separate method

Namespace string
PodName string
ContainerName string
AnotherContainerName string
Copy link
Contributor

Choose a reason for hiding this comment

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

AnotherContainerName is not actually needed for container tests, no?

"cpu.usage.core.ns": 43959424,
"cpu.usage.nanocores": 11263994,

"logs.available.bytes": int64(98727014400),
"logs.capacity.bytes": int64(101258067968),
"logs.used.bytes": 28672,
Copy link
Contributor

Choose a reason for hiding this comment

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

it was moved to basicTests

@gsantoro gsantoro merged commit 425e0f2 into elastic:main Aug 18, 2022
@gsantoro gsantoro deleted the feature/remove_k8s_cache_remove_test_dup branch August 18, 2022 11:44
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* refactoring some tests to avoid duplication

Co-authored-by: Andrew Gizas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup enhancement Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants