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

Bug log cleanup #1249

Merged
merged 3 commits into from May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Expand Up @@ -2,18 +2,18 @@
Synapse Changelog
*****************

<git tag> - YYYY-MM-DD
v0.1.9 - TDB
======================

Features and Enhancements
-------------------------

- Add new features (`#XXX <https://github.com/vertexproject/synapse/pull/XXX>`_)
- Add colored error reporting in Cmdr when a BadSyntax exception is sent to the user. (`#1248 <https://github.com/vertexproject/synapse/pull/1248>`_)

Bugfixes
--------

- Fix old bugs (`#XXX <https://github.com/vertexproject/synapse/pull/XXX>`_)
- Fix an issue where the Cmdr ``log`` command did not clean up all of its settings. (`#1249 <https://github.com/vertexproject/synapse/pull/1249>`_)

Improved Documentation
----------------------
Expand Down
5 changes: 3 additions & 2 deletions synapse/cmds/cortex.py
Expand Up @@ -143,8 +143,9 @@ def closeLogFd(self):
thr.join(2)
fp = self.locs.pop('log:fp', None)
fd = self.locs.pop('log:fd', None)
self.locs.pop('log:fmt', None)
self.locs.pop('log:splicesonly', None)
for key in list(self.locs.keys()):
if key.startswith('log:'):
self.locs.pop(key, None)
if fd:
try:
self.printf(f'Closing logfile: [{fp}]')
Expand Down
9 changes: 9 additions & 0 deletions synapse/tests/test_cmds_cortex.py
Expand Up @@ -152,6 +152,12 @@ async def test_storm(self):

async def test_log(self):

def check_locs_cleanup(cobj):
keys = list(cobj.locs.keys())
for key in keys:
if key.startswith('log:'):
self.fail(f'Key with "log:" prefix found. [{key}]')

async with self.getTestCoreAndProxy() as (realcore, core):

with self.getTestSynDir() as dirn:
Expand All @@ -163,6 +169,7 @@ async def test_log(self):
await cmdr.runCmdLine('storm [test:str=hi :tick=2018 +#haha.hehe]')
await cmdr.runCmdLine('log --off')
await cmdr.fini()
check_locs_cleanup(cmdr)

self.true(outp.expect('Starting logfile'))
self.true(outp.expect('Closing logfile'))
Expand All @@ -183,6 +190,7 @@ async def test_log(self):
await cmdr.runCmdLine('storm [test:str="I am a message!" :tick=1999 +#oh.my] ')
await cmdr.runCmdLine('log --off')
await cmdr.fini()
check_locs_cleanup(cmdr)

self.true(os.path.isfile(fp))
with s_common.genfile(fp) as fd:
Expand All @@ -199,6 +207,7 @@ async def test_log(self):
await cmdr.runCmdLine('storm [test:str="I am a message!" :tick=1999 +#oh.my] ')
await cmdr.runCmdLine('log --off')
await cmdr.fini()
check_locs_cleanup(cmdr)

self.true(os.path.isfile(fp))
with s_common.genfile(fp) as fd:
Expand Down