def _run_sarus(self): util.generate_ssh_keys() util.remove_image_if_necessary(is_centralized_repository=False, image=self._IMAGE_NAME) util.pull_image_if_necessary(is_centralized_repository=False, image=self._IMAGE_NAME) util.run_command_in_container(is_centralized_repository=False, image=self._IMAGE_NAME, command=["true"])
def _test_command_pull(self, image, is_centralized_repository): util.remove_image_if_necessary(is_centralized_repository, image) actual_images = util.list_images(is_centralized_repository) self.assertEqual(actual_images.count(image), 0) util.pull_image_if_necessary(is_centralized_repository, image) actual_images = util.list_images(is_centralized_repository) self.assertEqual(actual_images.count(image), 1)
def _test_command_rmi(self, is_centralized_repository): image = "alpine:latest" util.pull_image_if_necessary(is_centralized_repository, image) actual_images = set(util.list_images(is_centralized_repository)) self.assertTrue(image in actual_images) util.remove_image_if_necessary(is_centralized_repository, image) actual_images = set(util.list_images(is_centralized_repository)) self.assertTrue(image not in actual_images)
def test_image_with_symlink_over_directory(self): util.remove_image_if_necessary(is_centralized_repository=False, image=self._IMAGE_NAME) util.pull_image_if_necessary(is_centralized_repository=False, image=self._IMAGE_NAME) output = util.run_command_in_container(is_centralized_repository=False, image=self._IMAGE_NAME, command=["ls", "/usr/local/test".encode('utf-8')]) assert output[0] == "file" output = util.run_command_in_container(is_centralized_repository=False, image=self._IMAGE_NAME, command=["realpath", "/usr/local/test".encode('utf-8')]) assert output[0] == "/opt/test"
def _test_command_load(self, is_centralized_repository): util.remove_image_if_necessary(is_centralized_repository, "load/library/alpine:latest") image_name = "alpine" image_archive = os.path.dirname(os.path.realpath(__file__)) + "/saved_image.tar" util.load_image(is_centralized_repository, image_archive, image_name) actual_images = set(util.list_images(is_centralized_repository)) expected_images = {"load/library/alpine:latest"} self.assertTrue(expected_images.issubset(actual_images)) prettyname = util.run_image_and_get_prettyname(is_centralized_repository, "load/library/alpine:latest") self.assertEqual(prettyname, "Alpine Linux")
def _test_command_pull(self, is_centralized_repository): image = "alpine:latest" util.remove_image_if_necessary(is_centralized_repository, image) actual_images = util.list_images(is_centralized_repository) self.assertEqual(actual_images.count(image), 0) util.pull_image_if_necessary(is_centralized_repository, image) actual_images = util.list_images(is_centralized_repository) self.assertEqual(actual_images.count(image), 1) # check that multiple pulls of the same image don't generate # multiple entries in the list of available images util.pull_image_if_necessary(is_centralized_repository, image) actual_images = util.list_images(is_centralized_repository) self.assertEqual(actual_images.count(image), 1)