-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix integ tests for windows platform #3811
Conversation
Signed-off-by: Zelin Hao <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #3811 +/- ##
==========================================
+ Coverage 91.54% 91.61% +0.06%
==========================================
Files 182 182
Lines 5420 5438 +18
==========================================
+ Hits 4962 4982 +20
+ Misses 458 456 -2
|
src/system/process.py
Outdated
except Exception: | ||
pass |
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.
In case of exception, do we want to retry/ print / rethrow the exception? Not sure what we are trying to do in this entire try except block.
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.
Yeah make sense. Let me add some more for exception handle.
src/system/process.py
Outdated
for proc in psutil.process_iter(): | ||
try: | ||
for item in proc.open_files(): | ||
if self.stderr.name == item.path: | ||
logging.warning(f"stderr {item} is being used by process with this detail {proc}") | ||
except Exception: | ||
pass |
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.
Same as above.
Signed-off-by: Zelin Hao <[email protected]>
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.
Hi @zelinh adding some comments here.
Thanks.
Signed-off-by: Zelin Hao <[email protected]>
Signed-off-by: Zelin Hao <[email protected]> Signed-off-by: Prudhvi Godithi <[email protected]>
Description
Fixing the current error of unable to remove temp files when terminating the process and also adding
UTF-8
encoding when executing the process for results record purpose.According to the module document for
NamedTemporaryFile
, the temp file is open when we creating it and it may be supported to re-open it again by its name on Unix but not especially on windows platform.Also during my testing, the file was still open by python process even after we closed it by the file name.
item is popenfile(path='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\tmp2mlahvrq', fd=-1) and proc is psutil.Process(pid=6168, name='python.exe', status='running', started='23:49:13')
. Adding the for loop to check if it's closed before we remove it from the system will avoidPermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\tmpix2x74us'
which caused the issue before.When the process completed, our current
test-recorder
is not able to record thestdout.txt
for the dashboards on windows because it usescp1252
for encoding by default and we would getUnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1357: character maps to <undefined>
. I am addingutf-8
encoding to the subprocess execution to resolve this.Sample running tests:
Running on dashboards:
./test.sh integ-test ./manifests/2.8.0/opensearch-dashboards-2.8.0-test.yml -p opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.8.0/7935/windows/x64/zip opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/2.8.0/6182/windows/x64/zip --test-run-id 1234 --component alertingDashboards
Running for OpenSearch:
./test.sh integ-test ./manifests/2.8.0/opensearch-2.8.0-test.yml -p opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.8.0/7935/windows/x64/zip --component alerting --test-run-id 123
I have also run integ tests on our linux docker and the back compatibility of the changes is passing.
[opensearch@a49844d86db9 opensearch-build]$ ./test.sh integ-test ./manifests/2.8.0/opensearch-dashboards-2.8.0-test.yml -p opensearch=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.8.0/7935/linux/x64/tar opensearch-dashboards=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/2.8.0/6182/linux/x64/tar --test-run-id 1236 --component mlCommonsDashboards
Issues Resolved
#3196
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.