* Add progress info
This commit is contained in:
Chaoyi Yuan 2019-08-20 14:09:33 +08:00 коммит произвёл GitHub
Родитель 3631213013
Коммит 68fba174e0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 39 добавлений и 1 удалений

Просмотреть файл

@ -241,7 +241,13 @@ class Docker:
if key == "stream" and isinstance(json_[key], six.string_types):
self.output.procout(json_[key], nl=False)
if key == "status" and isinstance(json_[key], six.string_types):
self.output.procout(json_[key])
message = ""
if ("id" in json_):
message += json_["id"] + " "
message += json_[key] + " "
if ("progress" in json_):
message += json_["progress"]
self.output.procout(message)
# Docker SDK won't throw exceptions for some failures.
# We have to check the response ourselves.

Просмотреть файл

@ -4,6 +4,7 @@ import platform
import pytest
import shutil
import time
import re
from iotedgedev.compat import PY35
from iotedgedev.connectionstring import (DeviceConnectionString,
@ -16,6 +17,9 @@ from .utility import (assert_json_file_equal,
get_file_content,
get_all_docker_images,
get_all_docker_containers,
prune_docker_images,
prune_docker_containers,
prune_docker_build_cache,
remove_docker_container,
remove_docker_image,
get_docker_os_type,
@ -492,3 +496,16 @@ def test_push_modules_to_local_registry(prepare_solution_with_env):
remove_docker_container("registry")
if "registry" in get_all_docker_images():
remove_docker_image("registry:2")
# # TODO: The output of docker build logs is not captured by pytest, need to capture this before enable this test
# def test_docker_build_status_output():
# prune_docker_images()
# prune_docker_containers()
# prune_docker_build_cache()
# remove_docker_image("sample_module:0.0.1-RC")
# os.chdir(test_solution_shared_lib_dir)
# result = runner_invoke(['build', '-P', get_platform_type()])
# assert re.match('\\[=*>\\s*\\]', result.output) is not None

Просмотреть файл

@ -59,6 +59,21 @@ def get_all_docker_images():
return output
def prune_docker_images():
output = start_process(['docker', 'image', 'prune', '-f'], False)
return output
def prune_docker_containers():
output = start_process(['docker', 'container', 'prune', '-f'], False)
return output
def prune_docker_build_cache():
output = start_process(['docker', 'builder', 'prune', '-f'], False)
return output
def remove_docker_container(container_name):
output = start_process(['docker', 'rm', '-f', container_name], False)
return output