# HG changeset patch # User Mads Kiilerich # Date 1593035933 -7200 # Node ID 1e0cd9f75fbc5fa2b7a789d5030f59038b560836 # Parent aad27873f63d5f0164592cc707bc8061c5a13edc tests: fix test_vcs_operations for MariaDB/MySQL This is apparently only needed for MariaDB/MySQL where it will fix tests that were failing due to missing action log entries. diff -r aad27873f63d -r 1e0cd9f75fbc kallithea/tests/other/test_vcs_operations.py --- a/kallithea/tests/other/test_vcs_operations.py Thu Jun 25 11:32:39 2020 +0200 +++ b/kallithea/tests/other/test_vcs_operations.py Wed Jun 24 23:58:53 2020 +0200 @@ -358,6 +358,7 @@ # # # + Session.close() # make sure SA fetches all new log entries (apparently only needed for MariaDB/MySQL ...) action_parts = [ul.action.split(':', 1) for ul in UserLog.query().order_by(UserLog.user_log_id)] assert [(t[0], (t[1].count(',') + 1) if len(t) == 2 else 0) for t in action_parts] == ([ ('started_following_repo', 0), @@ -389,6 +390,7 @@ assert 'Repository size' in stdout assert 'Last revision is now' in stdout + Session.close() # make sure SA fetches all new log entries (apparently only needed for MariaDB/MySQL ...) action_parts = [ul.action.split(':', 1) for ul in UserLog.query().order_by(UserLog.user_log_id)] assert [(t[0], (t[1].count(',') + 1) if len(t) == 2 else 0) for t in action_parts] == \ [('pull', 0), ('push', 3)] @@ -403,6 +405,7 @@ clone_url = vt.repo_url_param(webserver, vt.repo_name) stdout, stderr = Command(dest_dir).execute(vt.repo_type, 'pull', clone_url) + Session.close() # make sure SA fetches all new log entries (apparently only needed for MariaDB/MySQL ...) if vt.repo_type == 'git': assert 'FETCH_HEAD' in stderr @@ -448,11 +451,10 @@ stdout, stderr = _add_files_and_push(webserver, vt, dest_dir, files_no=1, clone_url=clone_url) - Session().commit() # expire test session to make sure SA fetch new Repository instances after last_changeset has been updated server side hook in other process - if vt.repo_type == 'git': _check_proper_git_push(stdout, stderr) + Session.close() # expire session to make sure SA fetches new Repository instances after last_changeset has been updated by server side hook in another process post_cached_tip = [repo.get_api_data()['last_changeset']['short_id'] for repo in Repository.query().filter(Repository.repo_name == testfork[vt.repo_type])] assert pre_cached_tip != post_cached_tip @@ -487,6 +489,7 @@ elif vt.repo_type == 'hg': assert 'abort: HTTP Error 403: Forbidden' in stderr or 'abort: push failed on remote' in stderr and 'remote: Push access to %r denied' % str(vt.repo_name) in stdout + Session.close() # make sure SA fetches all new log entries (apparently only needed for MariaDB/MySQL ...) action_parts = [ul.action.split(':', 1) for ul in UserLog.query().order_by(UserLog.user_log_id)] assert [(t[0], (t[1].count(',') + 1) if len(t) == 2 else 0) for t in action_parts] == \ [('pull', 0)]