Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

FOGL-1127 - Fetch support bundle functionality along with unit tests #614

Merged
merged 2 commits into from
Mar 6, 2018

Conversation

ashish-jabble
Copy link
Contributor

Coverage 89%

35 statements   31 run || 4 missing || 0 excluded

Tests O/P

collected 10 items                                                                                                                            

services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle[pyloop-data0-expected_content0-2] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle[pyloop-data1-expected_content1-1] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle[pyloop-data2-expected_content2-0] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle[pyloop-data3-expected_content3-0] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle_by_name[pyloop] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle_by_name_not_found[pyloop-data0-xsupport-180301-133523.tar.gz] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle_by_name_not_found[pyloop-data1-support-180301-133523.tar.gz] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle_by_name_bad_request[pyloop] PASSED
services/core/api/test_support.py::TestBundleSupport::test_get_support_bundle_by_name_no_dir[pyloop] PASSED
services/core/api/test_support.py::TestBundleSupport::test_create_support_bundle[pyloop] PASSED

=== 10 passed in 0.73 seconds ==

Suite

collected 644 items

=== 639 passed, 5 skipped in 31.75 seconds ====

if _FOGLAMP_DATA:
support_dir = os.path.expanduser(_FOGLAMP_DATA + '/tmp/support')
else:
support_dir = os.path.expanduser(_FOGLAMP_ROOT + '/data/tmp/support')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarkRiddoch Please confirm here, if FOGLAMP_DATA is not set and update the JIRA

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is correct.

return web.HTTPBadRequest(reason="Bundle file extension is invalid")

if not os.path.isdir(_get_support_dir()):
raise web.HTTPNotFound(reason="Support bundle directory does not exist")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarkRiddoch If directory does not exist? HTTPNOTFOUND or HTTPINTERNALSERVER or nothing to raise

Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no directory then I think we should just raise a not found error as no support bundles have been created.

mockwalk.assert_called_once_with(path)

# FIXME: issue with URL having colon in it even after encoded with %3A manually or urllib parser
async def test_get_support_bundle_by_name(self, client, support_bundles_dir_path):
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarkRiddoch As per specs mentioned in FOGL-1126 (The file will be called support--HH:MM:SS.tar.gz).So I had added tests and example with this naming convention but somehow there is aiohttp bug on v2.3.8 and bug has fixed in 2.3.9 BUT with yarl dep 1.0.0

So if we need to follow the same file naming convention, we need to fix below things

  1. aiohttp dep set to 2.3.9
  2. and yarl dep explicitly set to 1.0.0

Please let me know, should I need to do above steps to make it work? or simplest and easiest way to just change the file naming convention we had in specs and do it like "support-YYMMDD-HH-MM-SS" or "support_YYMMDD_HH_MM_SS" or anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not too worried about the exact naming, so rather than force this update let's go for one of the alternate naming conventions. I would suggest support-YYMMDD-HH-MM-SS.



async def fetch_support_bundle_item(request):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

add docstring

MarkRiddoch
MarkRiddoch previously approved these changes Mar 2, 2018
Copy link
Contributor

@amarendra-dianomic amarendra-dianomic left a comment

Choose a reason for hiding this comment

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

LGTM!

@amarendra-dianomic amarendra-dianomic merged commit 822d9ec into develop Mar 6, 2018
@amarendra-dianomic amarendra-dianomic deleted the FOGL-1127 branch March 6, 2018 13:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants