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

Create conf directory if not exist to avoid NoSuchFile exceptions #9

Merged
merged 3 commits into from
May 6, 2021

Conversation

hxiao608
Copy link
Contributor

@hxiao608 hxiao608 commented May 5, 2021

Signoff by: Harold Xiao [email protected]

Describe the solution you are proposing
When running PA unit tests, errors with NoSuchFile exceptions will pop out, the reason is that the path to store the conf files is not exist. This PR add a conditional check to add the directory to avoid the exceptions.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.
Prerequisite: Add CONFIG_DIR_NOT_FOUND in StatExceptionCode
(https://github.com/opensearch-project/performance-analyzer-rca/pull/11/files)

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov-commenter
Copy link

Codecov Report

Merging #9 (fe5dca4) into main (12e92a7) will increase coverage by 0.48%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main       #9      +/-   ##
============================================
+ Coverage     71.73%   72.21%   +0.48%     
- Complexity      337      340       +3     
============================================
  Files            43       43              
  Lines          2452     2455       +3     
  Branches        149      150       +1     
============================================
+ Hits           1759     1773      +14     
+ Misses          588      577      -11     
  Partials        105      105              
Impacted Files Coverage Δ Complexity Δ
...analyzer/config/PerformanceAnalyzerController.java 77.58% <100.00%> (+8.55%) 25.00 <2.00> (+2.00)
...ormanceanalyzer/writer/EventLogQueueProcessor.java 61.66% <0.00%> (+3.33%) 7.00% <0.00%> (+1.00%)

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 12e92a7...fe5dca4. Read the comment docs.

@hxiao608 hxiao608 marked this pull request as draft May 5, 2021 18:57
@hxiao608 hxiao608 marked this pull request as ready for review May 5, 2021 20:25
@hxiao608 hxiao608 requested review from sruti1312 and jotok May 6, 2021 02:16
Path destDir = Paths.get(getDataDirectory());
if (!Files.exists(destDir)) {
StatsCollector.instance()
.logException(StatExceptionCode.CONFIG_DIR_NOT_FOUND);
Copy link
Contributor

Choose a reason for hiding this comment

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

What level is this logged at (e.g. error, warning)?

@hxiao608 hxiao608 merged commit ee24037 into main May 6, 2021
@sruti1312 sruti1312 deleted the haoruxia-conf-fix branch June 23, 2021 20:17
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.

4 participants