-
Notifications
You must be signed in to change notification settings - Fork 124
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
Use environment variables in config files #60 #80
Conversation
Junis are meant to be atomic. So you build tests like testBooleanVar teststringVar testIntegerVar testDataPipeFormat testOutputPipexxxx testDataPipeArrayFormat etc etc...go as many cases as you can think of, and combinations testBooleanStringxxxxx the tests also need to address the specific issue - values of pipe properties tests should also be there for malformed system var like and tests when something is referenced in json but not configured in env variable also need to be there. |
Also checkin comments need to be better - right now there are three commits with Use environment variables in config files. You can reference the issue in all commits, but the commit has to specify what is being changed too. |
The newly added testcases cover the above suggestions and other units/fragments of the the code changes. I tried to avoid redundant and out of scope scenarios. |
@@ -54,7 +92,8 @@ public void testCreateArgsMissingMatchFile() { | |||
} | |||
|
|||
@Test | |||
public void testCreateArgsMissingDelimiterFile() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these tests which are getting ignored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null"); | ||
} | ||
else { | ||
LOG.warn("The environment variable for {" + matcher.group(1) + "} is not set"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we throw an exception here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added Exception.
Made changes as per comments and the discussion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it is much better. few things
- print at warn level which variables are getting substituted - only name, not value.
- test that $var without an end $ throws an exception
- is there a way to ensure or test non .env file has no substitutions.
|
||
fail("Exception was expected for blank value for an environment variable"); | ||
} catch (IOException | ZinggClientException e) { | ||
System.out.println("Expected exception received due to blank value for an environment variable"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Made changes to add Logger in Tests; Added message for substituted environment variables as well. |
Feature to allow user to pass environment variables for the Zingg configuration values #60