StackStorm / StackStorm/st2

Command Error: st2-run-pack-tests -c

Open
#6,109 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Can not output the coverage report when unit test the stackstorm packs

STACKSTORM VERSION

st2 3.8.0, on Python 3.8.10

output of t2-run-pack-tests -c:
TEST RESULT OUTPUT:

Traceback (most recent call last):
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 109, in _execute
return self.con.execute(sql, parameters) # type: ignore[arg-type]
sqlite3.OperationalError: no such table: coverage_schema

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 114, in _execute
return self.con.execute(sql, parameters) # type: ignore[arg-type]
sqlite3.OperationalError: no such table: coverage_schema

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 293, in _read_db
row = db.execute_one("select version from coverage_schema")
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 181, in execute_one
with self.execute(sql, parameters) as cur:
File "/usr/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 144, in execute
cur = self._execute(sql, parameters)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 132, in _execute
raise DataError(f"Couldn't use data file {self.filename!r}: {msg}") from exc
coverage.exceptions.DataError: Couldn't use data file '/opt/stackstorm/packs/pgcloud/.coverage': no such table: coverage_schema

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/bin/nosetests", line 8, in
sys.exit(run_exit())
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/core.py", line 118, in init
unittest.TestProgram.init(
File "/usr/lib/python3.8/unittest/main.py", line 101, in init
self.runTests()
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/core.py", line 207, in runTests
result = self.testRunner.run(self.test)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/core.py", line 66, in run
result.printErrors()
File "/opt/stackstorm/st2/lib/python3.8/site-packages/rednose.py", line 442, in printErrors
self.config.plugins.report(self.stream)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/plugins/manager.py", line 99, in call
return self.call(*arg, **kw)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/nose/plugins/cover.py", line 183, in report
self.coverInstance.stop()
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/control.py", line 831, in combine
self.get_data()
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/control.py", line 862, in get_data
if self._collector.flush_data():
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/collector.py", line 521, in flush_data
self.covdata.add_lines(self.mapped_file_dict(line_data))
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 124, in _wrapped
return method(self, *args, **kwargs)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 495, in add_lines
self._choose_lines_or_arcs(lines=True)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 564, in _choose_lines_or_arcs
with self._connect() as con:
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 344, in _connect
self._open_db()
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 287, in _open_db
self._read_db()
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 297, in _read_db
self._init_db(db)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqldata.py", line 326, in _init_db
db.executescript(SCHEMA)
File "/tmp/st2-pack-tests-virtualenvs/pgcloud/lib/python3.8/site-packages/coverage/sqlitedb.py", line 220, in executescript
self.con.executescript(script).close()
sqlite3.OperationalError: database is locked
Deactivating virtualenv /tmp/st2-pack-tests-virtualenvs

OS, environment, install method

StackStorm on Kubernetes

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing st2-run-pack-tests -c in the reported StackStorm on Kubernetes environment and inspect how the coverage and nose reporting steps create or combine /opt/stackstorm/packs/pgcloud/.coverage. Trace the failure from the command through the reported coverage database errors; done means the pack tests complete and produce a coverage report without the coverage_schema or database-lock errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.