def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config .runner.corosync.version() .corosync_conf.load( node_name_list=["node-1", "node-2"], auto_tie_breaker=True, ) .http.add_communication( "check_auth", [ dict( label="node-1", output=json.dumps({"success": True}), response_code=200, ), dict( label="node-2", was_connected=False, errno=7, error_msg="Failed connect to node-2:2224;" " No route to host" , ), ], action="remote/check_auth", param_list=[("check_auth_only", 1)], ) )
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config.local.load_cluster_configs( cluster_node_list=[NODE_1, NODE_2]).local.check_node_availability( REMOTE_HOST, result=True).local.push_existing_authkey_to_remote(REMOTE_HOST) )
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config .local.load_cib() .corosync_conf.load(node_name_list=[NODE_1, NODE_2]) .local.check_node_availability(REMOTE_HOST) )
def setUp(self): # pylint: disable=invalid-name self.env_assist, self.config = get_env_tools(test_case=self) self.config.runner.cib.load( filename=self.initial_cib_filename, resources=self.initial_resources, )
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.config.runner.cib.load(resources=FIXTURE_RESOURCES) self.remove_resource = mock.Mock() self.config.env.set_known_hosts_dests({ NODE_NAME: NODE_DEST_LIST, })
def setUp(self): self.env_assist, self.config = get_env_tools(test_case=self) self.config.fs.open( settings.crm_mon_schema, mock.mock_open(read_data=crm_mon_rng_with_history)(), name="fs.open.crm_mon_rng" )
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config.runner.cib.load( resources=FIXTURE_RESOURCES).local.destroy_pacemaker_remote( label=NODE_NAME, dest_list=NODE_DEST_LIST)) self.config.env.set_known_hosts_dests({ NODE_NAME: NODE_DEST_LIST, })
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config.env.set_known_hosts_dests( KNOWN_HOSTS_DESTS).local.load_cib().corosync_conf.load( node_name_list=[NODE_1, NODE_2]).local.check_node_availability( NODE_NAME, NODE_DEST_LIST).local.push_existing_authkey_to_remote( NODE_NAME, NODE_DEST_LIST))
def test_success_on_valid_cib(self): cib_tempfile = "/fake/tmp/file" env_assist, config = get_env_tools(test_case=self) (config.env.set_cib_data("<cib/>", cib_tempfile=cib_tempfile).runner.pcmk.verify( cib_tempfile=cib_tempfile).runner.cib. load().runner.pcmk.load_state()) verify(env_assist.get_env())
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.name = "booth" self.config_path = os.path.join(settings.booth_config_dir, "{}.conf".format(self.name)) self.node_list = ["rh7-1", "rh7-2"] self.config.env.set_booth({"name": self.name}) self.reason = "fail"
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config.env.set_known_hosts_dests( KNOWN_HOSTS_DESTS).local.load_cib().corosync_conf.load( node_name_list=[NODE_1, NODE_2]).http.host.check_auth( communication_list=[ dict(label=NODE_NAME, dest_list=NODE_DEST_LIST) ], ).local.get_host_info(NODE_NAME, NODE_DEST_LIST))
def setUp(self): self.wait = 1 self.env_assist, self.config = get_env_tools(self) (self.config.runner.pcmk.can_wait().local.load_cluster_configs( cluster_node_list=[NODE_1, NODE_2]).local.check_node_availability( REMOTE_HOST, result=True).local.push_existing_authkey_to_remote(REMOTE_HOST) .local.run_pacemaker_remote(REMOTE_HOST).env.push_cib( resources=FIXTURE_RESOURCES, wait=self.wait))
def setUp(self): self.env_assist, self.config = get_env_tools(test_case=self) self.config.runner.cib.load(optional_in_conf=""" <alerts> <alert id="alert" path="path"> <recipient id="alert-recipient" value="value1"/> </alert> </alerts> """)
def setUp(self): self.env_assist, self.config = get_env_tools(test_case=self) self.config.runner.cib.load(optional_in_conf=""" <alerts> <alert id="alert1" path="path"/> <alert id="alert2" path="/path"/> <alert id="alert3" path="/path"/> <alert id="alert4" path="/path"/> </alerts> """)
def test_does_not_suport_timeout(self): env_assist, config = get_env_tools(test_case=self) (config.env.set_cib_data("<cib/>").runner.cib.load()) env = env_assist.get_env() env.get_cib() env_assist.assert_raise_library_error( lambda: env.push_cib_full(wait=10), [ fixture.error(report_codes.WAIT_FOR_IDLE_NOT_LIVE_CLUSTER), ], expected_in_processor=False)
def setUp(self): tmpfile_patcher = mock.patch("pcs.lib.pacemaker.live.write_tmpfile") self.addCleanup(tmpfile_patcher.stop) self.mock_write_tmpfile = tmpfile_patcher.start() self.tmpfile_old = mock_tmpfile("old.cib") self.tmpfile_new = mock_tmpfile("new.cib") self.mock_write_tmpfile.side_effect = [ self.tmpfile_old, self.tmpfile_new ] self.env_assist, self.config = get_env_tools(test_case=self)
def setUp(self): self.env_assist, self.config = get_env_tools(self) (self.config.env.set_known_hosts_dests( KNOWN_HOSTS_DESTS).local.load_cluster_configs( cluster_node_list=[NODE_1, NODE_2]).http.host.check_auth( communication_list=[ dict(label=NODE_NAME, dest_list=NODE_DEST_LIST) ], ).local.get_host_info( NODE_NAME, NODE_DEST_LIST).local.push_existing_authkey_to_remote( NODE_NAME, NODE_DEST_LIST))
def setUp(self): self.wait = 1 self.env_assist, self.config = get_env_tools(self) (self.config.env.set_known_hosts_dests(KNOWN_HOSTS_DESTS).runner.pcmk. can_wait().local.load_cluster_configs( cluster_node_list=[NODE_1, NODE_2]).local.check_node_availability( NODE_NAME, NODE_DEST_LIST).local.push_existing_authkey_to_remote( NODE_NAME, NODE_DEST_LIST).local.run_pacemaker_remote( NODE_NAME, NODE_DEST_LIST).env.push_cib( resources=FIXTURE_RESOURCES, wait=self.wait))
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.config.env.set_known_hosts_dests(KNOWN_HOSTS_DESTS) cib_xml_man = XmlManipulation.from_file(rc("cib-empty.xml")) cib_xml_man.append_to_first_tag_name( "resources", """ <primitive class="ocf" id="{0}" provider="heartbeat" type="VirtualDomain" /> """.format(VIRTUAL_MACHINE_ID)) self.config.env.set_cib_data(str(cib_xml_man))
def setUp(self): self.wait = 1 self.env_assist, self.config = get_env_tools(self) (self.config .runner.pcmk.can_wait() .local.load_cib() .corosync_conf.load(node_name_list=[NODE_1, NODE_2]) .local.check_node_availability(REMOTE_HOST) .local.push_existing_authkey_to_remote(REMOTE_HOST) .local.run_pacemaker_remote(REMOTE_HOST) .local.push_cib(wait=self.wait) )
def setUp(self): self.env_assistant, self.config = get_env_tools(self) self.corosync_conf_facade = mock.MagicMock(CorosyncConfigFacade) self.corosync_conf_text = "corosync conf" self.corosync_conf_facade.config.export.return_value = ( self.corosync_conf_text ) self.corosync_conf_facade.get_nodes.return_value = NodeAddressesList([ NodeAddresses("node-1"), NodeAddresses("node-2"), ]) self.corosync_conf_facade.need_stopped_cluster = False self.corosync_conf_facade.need_qdevice_reload = False self.node_labels = ["node-1", "node-2"]
def setUp(self): self.wait = 1 self.env_assist, self.config = get_env_tools(self) (self.config.env.set_known_hosts_dests(KNOWN_HOSTS_DESTS).runner.pcmk. can_wait().local.load_cib().corosync_conf.load( node_name_list=[NODE_1, NODE_2]).http.host.check_auth( communication_list=[ dict(label=NODE_NAME, dest_list=NODE_DEST_LIST) ], ).local.get_host_info( NODE_NAME, NODE_DEST_LIST).local.push_existing_authkey_to_remote( NODE_NAME, NODE_DEST_LIST).local.run_pacemaker_remote( NODE_NAME, NODE_DEST_LIST).local.push_cib(wait=self.wait))
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.name = "booth" self.node_name = "node" self.config_data = "config" self.config_path = _get_booth_file_path("{}.conf".format(self.name)) self.report_list = [ fixture.info(report_codes.BOOTH_FETCHING_CONFIG_FROM_NODE, node=self.node_name, config=self.name), fixture.info( report_codes.BOOTH_CONFIG_ACCEPTED_BY_NODE, node=None, name_list=[self.name], ) ] self.config.env.set_booth({"name": self.name})
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.config.runner.cib.load(resources=self.fixture_multi_resources) self.multiple_result_reports = (fixture.ReportStore().error( "multiple_result_found", report_codes.MULTIPLE_RESULTS_FOUND, result_identifier_list=[ VIRTUAL_MACHINE_ID, REMOTE_HOST, "C", ], result_type="resource", search_description=REMOTE_HOST, force_code=report_codes.FORCE_REMOVE_MULTIPLE_NODES).as_warn( "multiple_result_found", "multiple_result_found_warn", ))
def setUp(self): self.env_assist, self.config = get_env_tools(test_case=self) self.agent_name = "test_simple" self.instance_name = "stonith-test" self.timeout = 10 self.expected_cib = """ <resources> <group id="my-group"> <primitive class="stonith" id="stonith-test" type="test_simple"> <instance_attributes id="stonith-test-instance_attributes"> <nvpair id="stonith-test-instance_attributes-must-set" name="must-set" value="value" /> <nvpair id="stonith-test-instance_attributes-must-set-new" name="must-set-new" value="B" /> </instance_attributes> <operations> <op id="stonith-test-monitor-interval-60s" interval="60s" name="monitor" /> </operations> </primitive> </group> </resources> """ self.expected_status = """ <resources> <resource id="{id}" resource_agent="stonith:{agent}" role="Started" active="true" failed="false" nodes_running_on="1" > <node name="node1" id="1" cached="false"/> </resource> </resources> """.format(id=self.instance_name, agent=self.agent_name) (self.config.runner.pcmk.load_agent( agent_name="stonith:{0}".format(self.agent_name), agent_filename="stonith_agent_fence_simple.xml").runner.cib.load(). runner.pcmk.load_fenced_metadata())
def setUp(self): self.env_assist, self.config = get_env_tools(self) resources_before = """ <resources> <primitive id="R1" /> <primitive id="R2" /> </resources> """ resources_after = """ <resources> <group id="G"> <primitive id="R1" /> <primitive id="R2" /> </group> </resources> """ self.timeout = 10 (self.config.runner.pcmk.can_wait().runner.cib.load( resources=resources_before).env.push_cib(resources=resources_after, wait=self.timeout))
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.remove_resource = mock.Mock() (self.config.runner.cib.load(resources=self.fixture_multi_resources)) self.multiple_result_reports = (fixture.ReportStore().error( "multiple_result_found", report_codes.MULTIPLE_RESULTS_FOUND, result_identifier_list=[ NODE_NAME, REMOTE_HOST, ], result_type="resource", search_description=REMOTE_HOST, force_code=report_codes.FORCE_REMOVE_MULTIPLE_NODES).as_warn( "multiple_result_found", "multiple_result_found_warn", )) self.config.env.set_known_hosts_dests({ NODE_NAME: NODE_DEST_LIST, REMOTE_HOST: REMOTE_DEST_LIST, })
def test_sucess_create(self): env_assist, config = get_env_tools(test_case=self) (config.runner.cib.load(resources=""" <resources> <primitive id="resourceA" class="service" type="exim"/> </resources> """).env.push_cib(optional_in_conf=""" <constraints> <rsc_ticket id="ticket-ticketA-resourceA-Master" rsc="resourceA" rsc-role="Master" ticket="ticketA" loss-policy="fence" /> </constraints> """)) ticket_command.create(env_assist.get_env(), "ticketA", "resourceA", { "loss-policy": "fence", "rsc-role": "master" })
def setUp(self): self.env_assist, self.config = get_env_tools(self) self.config.runner.cib.load(resources=self.fixture_multi_resources) self.multiple_result_reports = (fixture.ReportStore().error( "multiple_result_found", report_codes.MULTIPLE_RESULTS_FOUND, result_identifier_list=[ VIRTUAL_MACHINE_ID, REMOTE_HOST, "C", ], result_type="resource", search_description=REMOTE_HOST, force_code=report_codes.FORCE_REMOVE_MULTIPLE_NODES).as_warn( "multiple_result_found", "multiple_result_found_warn", )) self.dest_list_b = [Destination("B-ADDR", 2224)] self.config.env.set_known_hosts_dests({ NODE_NAME: NODE_DEST_LIST, REMOTE_HOST: REMOTE_DEST_LIST, "B-NAME": self.dest_list_b, })
def setUp(self): self.env_assist, self.config = get_env_tools(test_case=self) self.config.runner.cib.load(optional_in_conf=""" <alerts> <alert id="alert" path="path"> <recipient id="alert-recipient" value="value1"/> <recipient id="alert-recipient-1" value="value" description="d" > <meta_attributes id="alert-recipient-1-meta_attributes" > <nvpair id="alert-recipient-1-meta_attributes-attr1" name="attr1" value="val1" /> <nvpair id="alert-recipient-1-meta_attributes-attr2" name="attr2" value="val2" /> </meta_attributes> <instance_attributes id="alert-recipient-1-instance_attributes" > <nvpair id="alert-recipient-1-instance_attributes-attr1" name="attr1" value="val1" /> </instance_attributes> </recipient> </alert> </alerts> """)