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(#937): Overrides environment variables when defined in resources #1434

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lordofthejars
Copy link
Contributor

@lordofthejars lordofthejars commented Nov 14, 2018

Fix #937 Still no tests or applied to all enrichers because I am not sure about the approach. I think this is the cleanest way of doing it, but waiting for some feedback.

private EnricherContext enricherContext;

@Test
public void should_set_environment_variables_from_resources() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @lordofthejars , this_underscore_format isn't consistent with the codebase. I know the the test method name is really long and will look clumsy in camelCase format but i think we should prioritize consistency of the code format here.

As per the accordance with the current format it can be simply,

@Test
public void setEnvironmentVarFromResources(....) { }

If there's a test annotation already, 'should' would look redundant in indicating assertions.

My $0.02.

@codecov
Copy link

codecov bot commented Dec 13, 2018

Codecov Report

Merging #1434 into master will increase coverage by 0.32%.
The diff coverage is 37.14%.

@@             Coverage Diff              @@
##             master    #1434      +/-   ##
============================================
+ Coverage     34.63%   34.96%   +0.32%     
- Complexity     1045     1052       +7     
============================================
  Files           172      171       -1     
  Lines          9553     9536      -17     
  Branches       1635     1620      -15     
============================================
+ Hits           3309     3334      +25     
+ Misses         5869     5839      -30     
+ Partials        375      363      -12

overrideEnvironmentVariables(builder, resourceConfig.getEnv()
.orElse(new HashMap<>()));
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Really not sure why we need to duplicate that piece of code in every enricher. For me that looks like a smell.

Whats about a post processing step outside of all enricher, which just overrides the environment variables added by the enricher chain ?

@lordofthejars
Copy link
Contributor Author

lordofthejars commented Dec 13, 2018 via email

@rhuss
Copy link
Contributor

rhuss commented Dec 14, 2018

@lordofthejars yeah, I remember darkly. Do you have an example for an enricher who does the environment differently ? Not sure anymore whether we should guarantee a consistent behaviour over all enrichers or not.

@rhuss
Copy link
Contributor

rhuss commented Dec 14, 2018

Test are failing because of a missing JMockit dependency. @lordofthejars could you please have a look ?

@rohanKanojia rohanKanojia added pr/change-requested Reviewer requested a change pr/changelog-entry-please Please add a changelog entry for this PR labels Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/change-requested Reviewer requested a change pr/changelog-entry-please Please add a changelog entry for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants