Page MenuHomeSoftware Heritage

Jenkins > .tox.py3-core-db-server-github-slow-cover.lib.python3.7.site-packages.swh.core.db.tests.test_cli::test_cli_swh_db_upgrade_new_api
Failed

TEST RESULT

Run At
May 31 2022, 9:21 AM
Details
cli_runner = <click.testing.CliRunner object at 0x7fa6e86b9fd0> postgresql = <connection object at 0x7fa6eb108a48; dsn: 'user=postgres password=xxx dbname=tests host=127.0.0.1 port=26870 options=''', closed: 0> datadir = '/var/lib/jenkins/workspace/DCORE/tests-on-diff/.tox/py3-core-db-server-github-slow-cover/lib/python3.7/site-packages/swh/core/db/tests/data' mocker = <pytest_mock.plugin.MockerFixture object at 0x7fa6e86b9be0> tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_cli_swh_db_upgrade_new_ap0') def test_cli_swh_db_upgrade_new_api(cli_runner, postgresql, datadir, mocker, tmp_path): """Upgrade scenario for a "new style" datastore""" module_name = "test.cli_new" # the `current_version` variable is the version that will be returned by # any call to `get_current_version()` in this test session, thanks to the # local mocked version of import_swhmodule() below. current_version = 1 # custom version of the mockup to make it easy to change the # current_version returned by get_current_version() # TODO: find a better solution for this... def import_swhmodule_mock(modname): if modname.startswith("test."): dirname = modname.split(".", 1)[1] def get_datastore(cls, **kw): return mocker.MagicMock(current_version=current_version) return mocker.MagicMock( __name__=modname, __file__=os.path.join(datadir, dirname, "__init__.py"), name=modname, get_datastore=get_datastore, ) return import_swhmodule(modname) mocker.patch("swh.core.db.db_utils.import_swhmodule", import_swhmodule_mock) conninfo = craft_conninfo(postgresql) # This initializes the schema and data cfgfile = tmp_path / "config.yml" cfgfile.write_text(yaml.dump({module_name: {"cls": "postgresql", "db": conninfo}})) result = cli_runner.invoke(swhdb, ["init-admin", module_name, "--dbname", conninfo]) > assert result.exit_code == 0, f"Unexpected output: {result.output}" E AssertionError: Unexpected output: E assert 1 == 0 E + where 1 = <Result UndefinedObject('role "guest" does not exist\n')>.exit_code .tox/py3-core-db-server-github-slow-cover/lib/python3.7/site-packages/swh/core/db/tests/test_cli.py:275: AssertionError