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

Fixes issue #84 - Support multiple config files #86

Closed
wants to merge 1 commit into from
Closed

Fixes issue #84 - Support multiple config files #86

wants to merge 1 commit into from

Conversation

asarkar
Copy link
Contributor

@asarkar asarkar commented Jan 16, 2018

Fixes issue #84 - Support multiple config files

@codecov-io
Copy link

codecov-io commented Jan 16, 2018

Codecov Report

Merging #86 into master will decrease coverage by 0.68%.
The diff coverage is 77.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
- Coverage   98.98%   98.29%   -0.69%     
==========================================
  Files          35       36       +1     
  Lines        1082     1117      +35     
  Branches      178      182       +4     
==========================================
+ Hits         1071     1098      +27     
- Misses          4       10       +6     
- Partials        7        9       +2
Impacted Files Coverage Δ
...io/github/azagniotov/stubby4j/yaml/YAMLParser.java 100% <ø> (ø) ⬆️
...io/github/azagniotov/stubby4j/utils/FileUtils.java 86.84% <20%> (-10.13%) ⬇️
...io/github/azagniotov/stubby4j/yaml/YAMLMerger.java 86.66% <86.66%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update deaaae0...a83b4eb. Read the comment docs.

);
}

List<Path> files = findAllYaml(configDir);
Copy link
Owner

Choose a reason for hiding this comment

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

What is the need to actually write into a merged temp file? Why not to just merge loaded sub-files in memory? Also, did you test the merge functionality when --watch command line argument is provided - will the changes to one of the sub files cause a reload?

long count = Files.lines(merged.toPath())
.filter(line -> line.trim().equals(str))
.count();
assertThat(count).isEqualTo(3L);
Copy link
Owner

Choose a reason for hiding this comment

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

Can you please avoid from asserting for something in the loop?


File merged = YAMLMerger.merge(resources.toFile());
assertThat(merged).isNotNull();
assertThat(merged.exists() && merged.isFile() && merged.canRead()).isTrue();
Copy link
Owner

Choose a reason for hiding this comment

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

Can you please break the boolean && boolean && boolean up to three assertThat statements? If something fails, it is less clear what exactly failed

*/
public class YAMLMergerTest {
@Test
public void testMerge() throws IOException, URISyntaxException {
Copy link
Owner

Choose a reason for hiding this comment

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

This test is testing too much. Can you please break it up for several atomic tests that tests different parts of the behavior?

*/
public class YAMLMergerTest {
@Test
public void testMerge() throws IOException, URISyntaxException {
Copy link
Owner

Choose a reason for hiding this comment

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

It is OK for tests to throws Exception if you are not testing for specific exception

public final class YAMLMerger {
private static final Logger LOGGER = LoggerFactory.getLogger(YAMLMerger.class);
private static final PathMatcher YAML_MATCHER = FileSystems.getDefault()
.getPathMatcher("glob:**.{yaml,yml}");
Copy link
Owner

Choose a reason for hiding this comment

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

There are no unit tests for "glob:**.{yaml,yml}"

@asarkar
Copy link
Contributor Author

asarkar commented Jan 16, 2018

Sorry, I've exhausted the time I estimated for working on this CR. You can:

  1. Close it.
  2. Take it as-is.
  3. Use it as basis for making whatever changes you feel are required.

@azagniotov azagniotov closed this Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants