swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f153cd93048>
listed_origins = [ListedOrigin(lister_id=UUID('b6e48816-998d-4cb2-9f19-dcf1ab8ebb63'), url='https://example.com/0000.git', visit_type='..., 16, 0, 0, 5, tzinfo=datetime.timezone.utc), last_scheduled=None, enabled=True, first_seen=None, last_seen=None), ...]
def test_schedule_next(swh_scheduler, listed_origins):
for task_type in TASK_TYPES.values():
swh_scheduler.create_task_type(task_type)
num_origins = 10
assert len(listed_origins) >= num_origins
swh_scheduler.record_listed_origins(listed_origins)
> result = invoke(swh_scheduler, args=("schedule-next", str(num_origins)))
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_cli_origin.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_cli_origin.py:17: in invoke
scheduler, args=["origin", *args], catch_exceptions=catch_exceptions
.tox/py3/lib/python3.7/site-packages/swh/scheduler/tests/test_cli.py:43: in invoke
raise result.exception
.tox/py3/lib/python3.7/site-packages/click/testing.py:329: in invoke
cli.main(args=args or (), prog_name=prog_name, **extra)
.tox/py3/lib/python3.7/site-packages/click/core.py:782: in main
rv = self.invoke(ctx)
.tox/py3/lib/python3.7/site-packages/click/core.py:1259: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1259: in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
.tox/py3/lib/python3.7/site-packages/click/core.py:1066: in invoke
return ctx.invoke(self.callback, **ctx.params)
.tox/py3/lib/python3.7/site-packages/click/core.py:610: in invoke
return callback(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/click/decorators.py:21: in new_func
return f(get_current_context(), *args, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/scheduler/cli/origin.py:127: in schedule_next
for origin in origins
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth
return meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/scheduler/backend.py:363: in create_tasks
cur.execute(query)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cursor object at 0x7f15443bfa48; closed: -1>
query = 'select type, arguments, next_run, policy, status, retries_left, priority, id, current_interval from swh_scheduler_create_tasks_from_temp()'
vars = None
def execute(self, query, vars=None):
self.column_mapping = []
self._query_executed = True
> return super(RealDictCursor, self).execute(query, vars)
E psycopg2.errors.ForeignKeyViolation: insert or update on table "task" violates foreign key constraint "task_type_fkey"
E DETAIL: Key (type)=(load-git) is not present in table "task_type".
E CONTEXT: SQL statement "insert into task (type, arguments, next_run, status, current_interval, policy,
E retries_left, priority)
E select type, arguments, next_run, status, current_interval, policy,
E retries_left, priority
E from tmp_task t
E where not exists(select 1
E from task
E where type = t.type and
E md5(arguments::text) = md5(t.arguments::text) and
E arguments = t.arguments and
E policy = t.policy and
E priority is not distinct from t.priority and
E status = t.status)"
E PL/pgSQL function swh_scheduler_create_tasks_from_temp() line 12 at SQL statement
.tox/py3/lib/python3.7/site-packages/psycopg2/extras.py:251: ForeignKeyViolation
TEST RESULT
TEST RESULT
- Run At
- Jan 12 2021, 5:14 PM