Skip to content

Commit

Permalink
CI: Test old packages with Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Jan 13, 2023
1 parent 5f6ba7d commit bf8b4c7
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions tests/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,15 +785,18 @@ def check_simple(args, stream, infile=1):
old_packages = [
('simple-0.4.0.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBVG4xZW1V'
'eDhXNTQ'),
'eDhXNTQ',
'arg_2'),
('simple-0.6.0.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBbl9SUjhr'
'cUdtbGs'),
'cUdtbGs',
'arg_2'),
('simple-0.7.1.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBRGp2Vm5V'
'QVpWOGs'),
'QVpWOGs',
'arg2'),
]
for name, url in old_packages:
for name, url, outputname in old_packages:
print("Testing old package %s" % name)
f = Path(name)
if not f.exists():
Expand All @@ -804,27 +807,30 @@ def check_simple(args, stream, infile=1):
check_call(rpuz + ['showfiles', name])
# Lists packages
check_call(rpuz + ['installpkgs', '--summary', name])
# Unpack directory
check_call(rpuz + ['directory', 'setup', name, 'simpledir'])
# Run directory
check_simple(rpuz + ['directory', 'run', 'simpledir'], 'err')
output_in_dir = Path('simpledir/root/tmp')
output_in_dir = output_in_dir.listdir('reprozip_*')[0]
output_in_dir = output_in_dir / 'simple_output.txt'
with output_in_dir.open(encoding='utf-8') as fp:
assert fp.read().strip() == '42'
# Delete with wrong command (should fail)
p = subprocess.Popen(rpuz + ['chroot', 'destroy', 'simpledir'],
stderr=subprocess.PIPE)
out, err = p.communicate()
assert p.poll() != 0
err = err.splitlines()
while b"DeprecationWarning" in err[0] or b"ImportWarning" in err[0]:
err = err[2:]
assert b"Wrong unpacker used" in err[0]
assert err[1].startswith(b"usage: ")
# Delete directory
check_call(rpuz + ['directory', 'destroy', 'simpledir'])
if not run_docker:
# Unpack directory
check_call(rpuz + ['directory', 'setup', name, 'simpledir'])
# Run directory
check_simple(rpuz + ['directory', 'run', 'simpledir'], 'err')
output_in_dir = Path('simpledir/root/tmp')
output_in_dir = output_in_dir.listdir('reprozip_*')[0]
output_in_dir = output_in_dir / 'simple_output.txt'
with output_in_dir.open(encoding='utf-8') as fp:
assert fp.read().strip() == '42'
# Delete directory
check_call(rpuz + ['directory', 'destroy', 'simpledir'])
else:
# Unpack docker
check_call(rpuz + ['docker', 'setup', name, 'simpledocker'])
# Run docker
check_simple(rpuz + ['docker', 'run', 'simpledocker'], 'out')
# Get output file
check_call(rpuz + ['docker', 'download', 'simpledocker',
outputname + ':doutput1.txt'])
with Path('doutput1.txt').open(encoding='utf-8') as fp:
assert fp.read().strip() == '42'
# Delete docker
check_call(rpuz + ['docker', 'destroy', 'simpledocker'])

# ########################################
# Copies back coverage report
Expand Down

0 comments on commit bf8b4c7

Please sign in to comment.