Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_rebuild_rootfs_format_v10_with_delete(self):
test_dir = self.extract_test_tar('docker/v10_format/busybox2.tgz')
image = docker.ImageV10(test_dir)
target_dir = self.get_temp_dir()
rebuild_rootfs(image, target_dir)
expected = [
'/lib/librt-0.9.33.2.so',
'/lib/libgcc_s.so.1',
'/lib/libutil-0.9.33.2.so',
'/lib/libuClibc-0.9.33.2.so',
'/lib/libm-0.9.33.2.so',
'/lib/libresolv-0.9.33.2.so',
'/lib/libnsl-0.9.33.2.so',
'/lib/libpthread-0.9.33.2.so'
]
assert sorted(expected) == sorted(f.replace(target_dir, '') for f in fileutils.file_iter(target_dir))
def test_rebuild_rootfs_format_v10(self):
test_dir = self.extract_test_tar('docker/v10_format/busybox.tgz')
image = docker.ImageV10(test_dir)
target_dir = self.get_temp_dir()
rebuild_rootfs(image, target_dir)
expected = self.extract_test_tar('docker/v10_format/check_busybox_layer.tar')
assert testcase.is_same(target_dir, expected)
def test_rebuild_rootfs_format_v10_without_repositories_file(self):
test_dir = self.extract_test_tar('docker/v10_format/busybox_no_repo.tgz')
image = docker.ImageV10(test_dir)
target_dir = self.get_temp_dir()
rebuild_rootfs(image, target_dir)
expected = self.extract_test_tar('docker/v10_format/check_busybox_layer.tar')
assert testcase.is_same(target_dir, expected)
def test_rebuild_rootfs_format_v10_with_delete_with_out_of_order_layers(self):
test_dir = self.extract_test_tar('docker/v10_format/busybox2.tgz')
image = docker.ImageV10(test_dir)
# shuffle artificially the layer order
image.layers = OrderedDict(sorted(image.layers.items()))
target_dir = self.get_temp_dir()
try:
rebuild_rootfs(image, target_dir)
except InconsistentLayersOderingError:
pass