docker-dev: fix vault test which fails the build
Build broken [1] [2]
Recent change introduced a symlink as README.rst in the swh-core module. This module is used to try and build the tarball from the vault. Which now fails the assertion.
So either the vault is fine and the test needs to be improved. Or the vault builds the tarball without taking into account the symlink case. In any case, a fix is in order.
- [1]
05:02:51 =================================== FAILURES ===================================
05:02:51 _____________________________ test_vault_directory _____________________________
05:02:51
05:02:51 scheduler_host = <testinfra.host.Host docker://docker_swh-scheduler_run_c030d9fb56f4>
05:02:51 git_origin = 'https://forge.softwareheritage.org/source/swh-core'
05:02:51
05:02:51 def test_vault_directory(scheduler_host, git_origin):
05:02:51 # retrieve the root directory of the master branch of the ingested git
05:02:51 # repository (by the git_origin fixture)
05:02:51 visit = apiget(f'origin/{quote_plus(git_origin)}/visit/latest')
05:02:51 snapshot = apiget(f'snapshot/{visit["snapshot"]}')
05:02:51 rev_id = snapshot["branches"]["refs/heads/master"]["target"]
05:02:51 revision = apiget(f'revision/{rev_id}')
05:02:51 dir_id = revision['directory']
05:02:51
05:02:51 # now cook it
05:02:51 cook = apiget(f'vault/directory/{dir_id}/', 'POST')
05:02:51 assert cook['obj_type'] == 'directory'
05:02:51 assert cook['obj_id'] == dir_id
05:02:51 assert cook['fetch_url'].endswith(f'vault/directory/{dir_id}/raw/')
05:02:51
05:02:51 # while it's cooking, get the directory tree from the archive
05:02:51 directory = getdirectory(dir_id)
05:02:51
05:02:51 # retrieve the cooked tar file
05:02:51 resp = pollapi(f'vault/directory/{dir_id}/raw')
05:02:51 tarf = tarfile.open(fileobj=io.BytesIO(resp.content))
05:02:51
05:02:51 # and check the tarfile seems ok wrt. 'directory'
05:02:51 assert tarf.getnames()[0] == dir_id
05:02:51 tarfiles = {t.name: t for t in tarf.getmembers()}
05:02:51
05:02:51 for fname, fdesc in directory:
05:02:51 tfinfo = tarfiles.get(join(dir_id, fname))
05:02:51 assert tfinfo, f"Missing path {fname} in retrieved tarfile"
05:02:51 if fdesc['type'] == 'file':
05:02:51 > assert fdesc['length'] == tfinfo.size, \
05:02:51 f"File {fname}: length mismatch"
05:02:51 E AssertionError: File docs/README.rst: length mismatch
05:02:51 E assert 13 == 0
05:02:51 E + where 0 = <TarInfo '24e386f2cd7ec6629b703e0bc6ece831bfe683b4/docs/README.rst' at 0x7f39203acb38>.size
Migrated from T3181 (view on Phabricator)