swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f5cb7d64c88>
clearcode_dsn = "dbname=clearcode user=postgres host=127.0.0.1 port=22773 options=''"
datadir = '/var/lib/jenkins/workspace/DMFCD/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/data'
def test_orchestrator(swh_storage, clearcode_dsn, datadir):
connection = psycopg2.connect(dsn=clearcode_dsn)
cursor = connection.cursor()
add_content_data(swh_storage)
# Fill data in clearcode database, for first time orchestration
fill_data_before_updation_of_storage(
connection=connection, cursor=cursor, datadir=datadir
)
orchestrator(storage=swh_storage, clearcode_dsn=clearcode_dsn)
# Check how much data is unmapped after first orchestration
assert 2 == get_length_of_unmapped_data(connection=connection, cursor=cursor)
> assert datetime(2021, 2, 6, 0, 0, tzinfo=timezone.utc) == get_last_run_date(
cursor=cursor
)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/test_orchestrator.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cursor = <cursor object at 0x7f5cb7f33808; closed: 0>
def get_last_run_date(cursor) -> Optional[datetime]:
"""
Take cursor as input and get last run date from which
new rows will be orchestered, return None if it's first
orchestration
"""
cursor.execute("SELECT value FROM clearcode_env WHERE key='date';")
rows = cursor.fetchall()
if len(rows) < 1:
return None
date = rows[0][0]
> return datetime.fromisoformat(date).replace(tzinfo=timezone.utc)
E ValueError: Invalid isoformat string: '2021-02-06 00:00:00+00'
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/orchestrator.py:81: ValueError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2021, 8:24 AM