#NEWLINE# def test_local_not_running_applications_restarted( self ) : #NEWLINE# #INDENT# '\n        Applications that are not running but are supposed to be on the local\n        node are restarted by Flocker (we cannot rely on Docker restart\n        policies to do so because FLOC-3148).\n        ' #NEWLINE# api = ApplicationNodeDeployer ( 'n.example.com' , docker_client = FakeDockerClient ( ) , network = make_memory_network ( ) , node_uuid = uuid4 ( ) ) #NEWLINE# application_desired = Application ( name = b'mysql-hybridcluster' , image = DockerImage ( repository = 'clusterhq/flocker' , tag = 'release-14.0' ) ) #NEWLINE# application_stopped = application_desired . set ( 'running' , False ) #NEWLINE# nodes_desired = frozenset ( [ Node ( uuid = api . node_uuid , applications = frozenset ( [ application_desired ] ) ) ] ) #NEWLINE# node_state = NodeState ( hostname = api . hostname , uuid = api . node_uuid , applications = [ application_stopped ] ) #NEWLINE# desired = Deployment ( nodes = nodes_desired ) #NEWLINE# result = api . calculate_changes ( desired_configuration = desired , current_cluster_state = DeploymentState ( nodes = [ node_state ] ) , local_state = NodeLocalState ( node_state = node_state ) ) #NEWLINE# expected = sequentially ( changes = [ in_parallel ( changes = [ sequentially ( changes = [ StopApplication ( application = application_stopped ) , StartApplication ( application = application_desired , node_state = node_state ) ] ) ] ) ] ) #NEWLINE# self . assertEqual ( expected , result )