@@ -260,21 +260,21 @@ def test_valid_env_device_connectionstring():
260260 assert connectionstring .device_id
261261
262262
263- # def test_create_new_solution():
264- # os.chdir(tests_dir)
265- # clean_folder(test_solution_dir)
266- #
267- # for template in templates:
268- # # Node.js modules is skipped on non-Windows for below known issue.
269- # # https://github.com/Azure/iotedgedev/issues/312
270- # # https://github.com/Azure/iotedgedev/issues/346
271- # if (template == "nodejs") and (platform.system().lower() != 'windows'):
272- # continue
273- # else:
274- # result = create_solution(template)
275- # assert_solution_folder_structure(template)
276- # assert 'AZURE IOT EDGE SOLUTION CREATED' in result.output
277- # clean_folder(test_solution_dir)
263+ def test_create_new_solution ():
264+ os .chdir (tests_dir )
265+ clean_folder (test_solution_dir )
266+
267+ for template in templates :
268+ # Node.js modules is skipped on non-Windows for below known issue.
269+ # https://github.com/Azure/iotedgedev/issues/312
270+ # https://github.com/Azure/iotedgedev/issues/346
271+ if (template == "nodejs" ) and (platform .system ().lower () != 'windows' ):
272+ continue
273+ else :
274+ result = create_solution (template )
275+ assert_solution_folder_structure (template )
276+ assert 'AZURE IOT EDGE SOLUTION CREATED' in result .output
277+ clean_folder (test_solution_dir )
278278
279279
280280# def test_solution_push_with_default_platform(prepare_solution_with_env):
@@ -433,24 +433,24 @@ def test_gen_config_with_non_string_placeholder():
433433 assert "ERROR" not in result .output
434434
435435
436- # @mock.patch.dict(os.environ, {"CONTAINER_REGISTRY_SERVER": "localhost:5000"})
437- # @pytest.mark.skipif(get_docker_os_type() == 'windows', reason='windows container does not support local registry image')
438- # def test_push_modules_to_local_registry(prepare_solution_with_env):
439- # try:
440- # module_name = "filtermodule"
441- #
442- # if module_name in get_all_docker_images():
443- # remove_docker_image(module_name)
444- #
445- # result = runner_invoke(['push', '-P', get_platform_type()])
446- #
447- # assert 'ERROR' not in result.output
448- # assert result.exit_code == 0
449- # assert 'BUILD COMPLETE' in result.output
450- # assert 'PUSH COMPLETE' in result.output
451- # assert f"localhost:5000/{module_name in get_all_docker_images()}"
452- # finally:
453- # if "registry" in get_all_docker_containers():
454- # remove_docker_container("registry")
455- # if "registry" in get_all_docker_images():
456- # remove_docker_image("registry:2")
436+ @mock .patch .dict (os .environ , {"CONTAINER_REGISTRY_SERVER" : "localhost:5000" })
437+ @pytest .mark .skipif (get_docker_os_type () == 'windows' , reason = 'windows container does not support local registry image' )
438+ def test_push_modules_to_local_registry (prepare_solution_with_env ):
439+ try :
440+ module_name = "filtermodule"
441+
442+ if module_name in get_all_docker_images ():
443+ remove_docker_image (module_name )
444+
445+ result = runner_invoke (['push' , '-P' , get_platform_type ()])
446+
447+ assert 'ERROR' not in result .output
448+ assert result .exit_code == 0
449+ assert 'BUILD COMPLETE' in result .output
450+ assert 'PUSH COMPLETE' in result .output
451+ assert f"localhost:5000/{ module_name in get_all_docker_images ()} "
452+ finally :
453+ if "registry" in get_all_docker_containers ():
454+ remove_docker_container ("registry" )
455+ if "registry" in get_all_docker_images ():
456+ remove_docker_image ("registry:2" )
0 commit comments