#NEWLINE# @ flaky ( 'FLOC-3330' ) #NEWLINE# @ if_docker_configured #NEWLINE# def test_cpu_shares( self ) : #NEWLINE# #INDENT# '\n        The CPU shares number specified in an ``Application`` is passed to the\n        container.\n        ' #NEWLINE# EXPECTED_CPU_SHARES = 512 #NEWLINE# image = DockerImage . from_string ( 'openshift/busybox-http-app' ) #NEWLINE# application_name = random_name ( self ) #NEWLINE# docker_client = DockerClient ( ) #NEWLINE# self . addCleanup ( docker_client . remove , application_name ) #NEWLINE# deployer = ApplicationNodeDeployer ( 'localhost' , docker_client , make_memory_network ( ) , node_uuid = uuid4 ( ) ) #NEWLINE# desired_state = Deployment ( nodes = frozenset ( [ Node ( uuid = deployer . node_uuid , applications = frozenset ( [ Application ( name = application_name , image = image , cpu_shares = EXPECTED_CPU_SHARES ) ] ) ) ] ) ) #NEWLINE# d = change_node_state ( deployer , desired_state ) #NEWLINE# d . addCallback ( ( lambda _ : wait_for_unit_state ( reactor , docker_client , application_name , [ 'active' ] ) ) ) #NEWLINE# def inspect_application( _ ) : #NEWLINE# #INDENT# deferred_list = docker_client . list ( ) #NEWLINE# def app_cpu_shares( unit ) : #NEWLINE# #INDENT# self . assertEqual ( unit . cpu_shares , EXPECTED_CPU_SHARES ) #NEWLINE# #UNINDENT# deferred_list . addCallback ( find_unit , application_name ) #NEWLINE# deferred_list . addCallback ( app_cpu_shares ) #NEWLINE# return deferred_list #NEWLINE# #UNINDENT# d . addCallback ( inspect_application ) #NEWLINE# return d