Skip to content
Snippets Groups Projects
Commit 9ad5fe2f authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'errors_unified' into 'develop'

Unified some error messages and added CI groups for tests made in new scheme

See merge request !114
parents ae436d8d ef38aa36
No related branches found
No related tags found
5 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!138Small typos fixed,!135Enable postgres monitoring on CI server,!114Unified some error messages and added CI groups for tests made in new scheme
......@@ -174,26 +174,66 @@ hivemind_stop_server:
tags:
- hivemind
bridge_api_smoketest_old:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_bridge_api_patterns.tavern.yaml api_smoketest_bridge_old.xml
artifacts:
reports:
junit: api_smoketest_bridge_old.xml
bridge_api_smoketest:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_bridge_api_patterns.tavern.yaml api_smoketest_bridge.xml
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" bridge_api_patterns/ api_smoketest_bridge.xml
artifacts:
reports:
junit: api_smoketest_bridge.xml
bridge_api_smoketest_negative:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" bridge_api_negative/ api_smoketest_bridge_negative.xml
artifacts:
reports:
junit: api_smoketest_bridge_negative.xml
condenser_api_smoketest_old:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_condenser_api_patterns.tavern.yaml api_smoketest_condenser_api_old.xml
artifacts:
reports:
junit: api_smoketest_condenser_api_old.xml
condenser_api_smoketest:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_condenser_api_patterns.tavern.yaml api_smoketest_condenser_api.xml
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" condenser_api_patterns/ api_smoketest_condenser_api.xml
artifacts:
reports:
junit: api_smoketest_condenser_api.xml
condenser_api_smoketest_negative:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" condenser_api_negative/ api_smoketest_condenser_api_negative.xml
artifacts:
reports:
junit: api_smoketest_condenser_api_negative.xml
database_api_smoketest_old:
<<: *common_api_smoketest_job
......@@ -214,11 +254,31 @@ database_api_smoketest:
reports:
junit: api_smoketest_database_api.xml
database_api_smoketest_negative:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" database_api_negative/ api_smoketest_database_api_negative.xml
artifacts:
reports:
junit: api_smoketest_database_api_negative.xml
follow_api_smoketest_old:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_follow_api_patterns.tavern.yaml api_smoketest_follow_api_old.xml
artifacts:
reports:
junit: api_smoketest_follow_api_old.xml
follow_api_smoketest:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_follow_api_patterns.tavern.yaml api_smoketest_follow_api.xml
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" follow_api_patterns/ api_smoketest_follow_api.xml
artifacts:
reports:
......@@ -244,4 +304,3 @@ tags_api_smoketest:
reports:
junit: api_smoketest_tags_api.xml
......@@ -787,7 +787,7 @@ def setup(db):
WHERE ha.name = _author AND hpd.permlink = _permlink AND hp.counter_deleted = 0
), 0 );
IF _check AND (_author <> '' OR _permlink <> '') AND post_id = 0 THEN
RAISE EXCEPTION 'Post/comment %/% does not exist', _author, _permlink;
RAISE EXCEPTION 'Post %/% does not exist', _author, _permlink;
END IF;
RETURN post_id;
END
......
......@@ -59,7 +59,7 @@ class Accounts:
def get_id(cls, name):
"""Get account id by name. Throw if not found."""
assert isinstance(name, str), "account name should be string"
assert name in cls._ids, "account does not exist or was not registered"
assert name in cls._ids, 'Account \'%s\' does not exist' % name
return cls._ids[name]
@classmethod
......
......@@ -461,7 +461,7 @@ class CommunityOp:
_name = read_key_str(self.op, 'community', 16)
assert _name, 'must name a community'
_id = Community.validated_id(_name)
assert _id, 'community `%s` does not exist' % _name
assert _id, 'Community \'%s\' does not exist' % _name
self.community = _name
self.community_id = _id
......
......@@ -66,7 +66,7 @@ async def get_profile(context, account, observer=None):
"""Load account/profile data."""
db = context['db']
ret = await load_profiles(db, [valid_account(account)])
assert ret, 'account \'{}\' does not exist'.format(account)
assert ret, 'Account \'{}\' does not exist'.format(account)
observer_id = await get_account_id(db, observer) if observer else None
if observer_id:
......
......@@ -34,7 +34,7 @@ async def get_post_header(context, author, permlink):
row = await db.query_row(sql, author=author, permlink=permlink)
assert row, 'post \'@{}/{}\' does not exist'.format(author,permlink)
assert row, 'Post {}/{} does not exist'.format(author,permlink)
return dict(
author=row['author'],
......
......@@ -5,6 +5,7 @@ from functools import wraps
import traceback
import logging
import datetime
from psycopg2.errors import RaiseException
log = logging.getLogger(__name__)
......@@ -20,6 +21,9 @@ def return_error_info(function):
"""Catch ApiError and AssersionError (always due to user error)."""
try:
return await function(*args, **kwargs)
except (RaiseException) as e:
log.error("PGSQL: %s\n%s", repr(e), traceback.format_exc())
raise AssertionError(e.diag.message_primary)
except (ApiError, AssertionError, TypeError, Exception) as e:
if isinstance(e, KeyError):
#TODO: KeyError overloaded for method not found. Any KeyErrors
......
Subproject commit 7d925b4e88faafd6d0154725bfe26d7bdfaee23f
Subproject commit 4ee51004b4d83d2c12ca8f6e10faab762cc0262f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment