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

[Test]Avoid mocking the value returned in global SETTINGS constant #16245

Merged

Conversation

andsel
Copy link
Contributor

@andsel andsel commented Jun 20, 2024

Release notes

[rn:skip]

What does this PR do?

This a refactoring of test fixture.
Avoid mocking the value returned in global SETTINGS constant. Use instead the local setting map instance used in subject creation.

Why is it important/What is the impact to the user?

As a developer I want to leverage as less as possible mocking on objects that just carry values.
The spirit is mock behaviour not data.

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 (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

…tead the local setting map instance used in subject creation
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

overall this ends up testing a slightly different thing (testing settings read from the global settings vs those of the pipeline, but I think the test still makes sense and the origin in this case doesn't matter, so LGTM

@andsel andsel merged commit ed930f8 into elastic:main Jun 20, 2024
6 checks passed
andsel added a commit to andsel/logstash that referenced this pull request Jul 12, 2024
…c#16245)

This a refactoring of test fixture.
Avoid mocking the value returned in global SETTINGS constant. Use instead the local setting map instance used in subject creation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants