-
Notifications
You must be signed in to change notification settings - Fork 42
FOGL-1127 - Fetch support bundle functionality along with unit tests #614
Conversation
if _FOGLAMP_DATA: | ||
support_dir = os.path.expanduser(_FOGLAMP_DATA + '/tmp/support') | ||
else: | ||
support_dir = os.path.expanduser(_FOGLAMP_ROOT + '/data/tmp/support') |
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.
@MarkRiddoch Please confirm here, if FOGLAMP_DATA is not set and update the JIRA
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.
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") |
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.
@MarkRiddoch If directory does not exist? HTTPNOTFOUND or HTTPINTERNALSERVER or nothing to raise
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.
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): |
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.
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.
@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
- aiohttp dep set to 2.3.9
- 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.
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.
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): | ||
""" |
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.
add docstring
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.
LGTM!
Coverage 89%
Tests O/P
Suite