Project

General

Profile

Actions

Bug #7601

closed

Tests do not create events table in some cases

Added by Rajmund Hruska 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
Testing
Target version:
Start date:
07/27/2022
Due date:
% Done:

100%

Estimated time:
To be discussed:
No

Description

ERROR: test_02_as_user (hawat.blueprints.timeline.test.__init__.SearchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/workers/worker-mentat-py3/mentat-check/build/lib/hawat/events.py", line 49, in _get_values
    return _get_cached_values(cache_file)
  File "/home/buildbot/workers/worker-mentat-py3/mentat-check/build/lib/hawat/events.py", line 42, in _get_cached_values
    cache_file
  File "/home/buildbot/workers/worker-mentat-py3/venv/lib/python3.7/site-packages/pyzenkit/jsonconf.py", line 153, in json_load
    with open(json_file, "r") as jsf:
FileNotFoundError: [Errno 2] No such file or directory: '/home/buildbot/workers/worker-mentat-py3/mentat-check/build/chroot/var/mentat/cache/itemset-stat-sourcetypes.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/buildbot/workers/worker-mentat-py3/mentat-check/build/lib/mentat/services/eventstorage.py", line 983, in exc_handle_wrapper
    return func(self, *args, **kwargs)
  File "/home/buildbot/workers/worker-mentat-py3/mentat-check/build/lib/mentat/services/eventstorage.py", line 1451, in distinct_values
    self.cursor.execute(enum_query)
  File "/home/buildbot/workers/worker-mentat-py3/venv/lib/python3.7/site-packages/psycopg2/extras.py", line 319, in execute
    return super(NamedTupleCursor, self).execute(query, vars)
psycopg2.errors.UndefinedTable: relation "enum_source_type" does not exist
LINE 1: INSERT INTO "enum_source_type" (SELECT * FROM (SELECT unnest...
Actions #1

Updated by Rajmund Hruska 4 months ago

def _get_cached_values(cache_file):
    cache_dir = flask.current_app.config.get(
        hawat.const.CFGKEY_MENTAT_CACHE_DIR
    )
    return pyzenkit.jsonconf.json_load(
        os.path.join(
            cache_dir,
            cache_file
        )
    )

def _get_values(cache_file, column):
    try:
        return _get_cached_values(cache_file)
    except FileNotFoundError:
        return db_get().distinct_values(column)

I see two questions/issues here:
1. Why chroot/var/mentat/cache/itemset-stat-sourcetypes.json did not exist.
2. Why tables from mentat_events were not created.

Actions #2

Updated by Rajmund Hruska 4 months ago

(1): I didn't have this issue in Vagrant because of this line:

sudo -u mentat ${MENTAT_VENV}/bin/python /vagrant/bin/mentat-precache.py --allow-empty

in vagrantenv/provisioning/p02_mentat.sh which creates those files.

Also, I think the reason why this issue appeared just now is because nose didn't execute all tests. All of the tests are executed now, with nose2.

Actions #3

Updated by Rajmund Hruska 4 months ago

  • Status changed from New to In Review
  • % Done changed from 0 to 100

Now tables from mentat_events are created in all Hawat test suites.

Actions #4

Updated by Pavel Kácha 4 months ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF