swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f3a31edff28>
clearcode_dsn = "dbname=clearcode user=postgres host=127.0.0.1 port=24254 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 "2021-02-06 00:00:00+00" == get_last_run_date(cursor=cursor)
content_data.extend(
[Content.from_data(b"424242\n"), Content.from_data(b"42424242\n")]
)
add_content_data(swh_storage)
# Run orchestration after insertion in swh storage and
# check how much data is unmapped after second orchestration
> orchestrator(storage=swh_storage, clearcode_dsn=clearcode_dsn)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/test_orchestrator.py:158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/orchestrator.py:202: in orchestrator
map_previously_unmapped_data(storage=storage, cursor=cursor, connection=connection)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/orchestrator.py:128: in map_previously_unmapped_data
connection=connection,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
storage = <swh.storage.postgresql.storage.Storage object at 0x7f3a31edff28>
cursor = <cursor object at 0x7f3a31f289f8; closed: 0>
connection = <connection object at 0x7f3a31d65048; dsn: 'dbname=clearcode user=postgres host=127.0.0.1 port=24254 options=''', closed: 0>
row = ('npm/npmjs/@pixi/mesh-extras/revision/5.3.6/tool/clearlydefined/1.3.4.json', <memory at 0x7f3a31fb0b88>, datetime.datetime(2021, 2, 6, 0, 0, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)))
def orchestrate_row(storage: StorageInterface, cursor, connection, row: Row) -> bool:
"""
Take storage, cursor, connection, row as input
and if able to completely map that row then write
data in storage, else store the ID in state
"""
able_to_be_mapped = map_row(
> metadata=row.metadata, id=row.path, date=row.date, storage=storage
)
E AttributeError: 'tuple' object has no attribute 'metadata'
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/orchestrator.py:89: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Feb 22 2021, 9:17 AM