本文整理汇总了Python中test.fixture.build_input函数的典型用法代码示例。如果您正苦于以下问题:Python build_input函数的具体用法?Python build_input怎么用?Python build_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_input函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_ha_no_dedicated_nodes
def test_ha_no_dedicated_nodes(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', True, False),
('10.0.0.3', True, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
master_lb=('10.0.0.5', False),
storage='10.1.0.1',)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args,
input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 5, 5)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 5)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=True')
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.2',
'openshift_schedulable=True')
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.3',
'openshift_schedulable=True')
开发者ID:fedora-cloud,项目名称:openshift-ansible,代码行数:32,代码来源:cli_installer_tests.py
示例2: test_gen_inventory
def test_gen_inventory(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', False, False),
('10.0.0.3', False, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
storage='10.1.0.1',)
self.cli_args.append("install")
self.cli_args.append("--gen-inventory")
result = self.runner.invoke(cli.cli, self.cli_args,
input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
# Make sure run playbook wasn't called:
self.assertEquals(0, len(run_playbook_mock.mock_calls))
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 4)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=False')
self.assert_inventory_host_var_unset(inventory, 'nodes', '10.0.0.2',
'openshift_schedulable=True')
self.assert_inventory_host_var_unset(inventory, 'nodes', '10.0.0.3',
'openshift_schedulable=True')
开发者ID:fedora-cloud,项目名称:openshift-ansible,代码行数:34,代码来源:cli_installer_tests.py
示例3: test_scaleup_hint
def test_scaleup_hint(self, load_facts_mock, run_playbook_mock):
# Modify the mock facts to return a version indicating OpenShift
# is already installed on our master, and the first node.
mock_facts = copy.deepcopy(MOCK_FACTS)
mock_facts['10.0.0.1']['common']['version'] = "3.0.0"
mock_facts['10.0.0.2']['common']['version'] = "3.0.0"
load_facts_mock.return_value = (mock_facts, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', False, False),
],
add_nodes=[('10.0.0.3', False, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
storage='10.0.0.1',)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli,
self.cli_args,
input=cli_input)
# This is testing the install workflow so we want to make sure we
# exit with the appropriate hint.
self.assertTrue('scaleup' in result.output)
self.assert_result(result, 1)
开发者ID:fedora-cloud,项目名称:openshift-ansible,代码行数:29,代码来源:cli_installer_tests.py
示例4: test_full_run
def test_full_run(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', False, False),
('10.0.0.3', False, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y')
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args,
input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 3, 3)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 3)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
self.assertEquals('False',
inventory.get('nodes', '10.0.0.1 openshift_schedulable'))
self.assertEquals(None,
inventory.get('nodes', '10.0.0.2'))
self.assertEquals(None,
inventory.get('nodes', '10.0.0.3'))
开发者ID:claytonspinner,项目名称:openshift-ansible,代码行数:30,代码来源:cli_installer_tests.py
示例5: test_add_nodes
def test_add_nodes(self, load_facts_mock, run_playbook_mock):
# Modify the mock facts to return a version indicating OpenShift
# is already installed on our master, and the first node.
mock_facts = copy.deepcopy(MOCK_FACTS)
mock_facts['10.0.0.1']['common']['version'] = "3.0.0"
mock_facts['10.0.0.2']['common']['version'] = "3.0.0"
load_facts_mock.return_value = (mock_facts, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', False, False),
],
add_nodes=[('10.0.0.3', False, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y')
self.cli_args.append("install")
result = self.runner.invoke(cli.cli,
self.cli_args,
input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 3, 2)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 3)
开发者ID:claytonspinner,项目名称:openshift-ansible,代码行数:30,代码来源:cli_installer_tests.py
示例6: test_full_run
def test_full_run(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(
hosts=[("10.0.0.1", True, False), ("10.0.0.2", False, False), ("10.0.0.3", False, False)],
ssh_user="root",
variant_num=1,
confirm_facts="y",
storage="10.1.0.1",
)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 4, 4)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 4)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, "hosts"))
self.assert_inventory_host_var(inventory, "nodes", "10.0.0.1", "openshift_schedulable=False")
self.assert_inventory_host_var_unset(inventory, "nodes", "10.0.0.2", "openshift_schedulable")
self.assert_inventory_host_var_unset(inventory, "nodes", "10.0.0.3", "openshift_schedulable")
开发者ID:nicodenis,项目名称:openshift-ansible,代码行数:26,代码来源:cli_installer_tests.py
示例7: test_all_in_one
def test_all_in_one(self, load_facts_mock, prerequisites_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
prerequisites_mock.return_value = 0
run_playbook_mock.return_value = 0
cli_input = build_input(
hosts=[
('10.0.0.1', True, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
storage='10.0.0.1')
self.cli_args.append("install")
result = self.runner.invoke(
cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 1, 1)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 1)
inventory = configparser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=True')
开发者ID:ubertasconsulting,项目名称:openshift-ansible-dev,代码行数:27,代码来源:cli_installer_tests.py
示例8: test_ha_no_dedicated_nodes
def test_ha_no_dedicated_nodes(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(
hosts=[("10.0.0.1", True, False), ("10.0.0.2", True, False), ("10.0.0.3", True, False)],
ssh_user="root",
variant_num=1,
confirm_facts="y",
master_lb=("10.0.0.5", False),
)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 4, 4)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 4)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, ".ansible/hosts"))
self.assertEquals("True", inventory.get("nodes", "10.0.0.1 openshift_schedulable"))
self.assertEquals("True", inventory.get("nodes", "10.0.0.2 openshift_schedulable"))
self.assertEquals("True", inventory.get("nodes", "10.0.0.3 openshift_schedulable"))
开发者ID:amon-ra,项目名称:openshift-ansible,代码行数:26,代码来源:cli_installer_tests.py
示例9: test_ha_hint
def test_ha_hint(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[("10.0.0.1", True, False)], ssh_user="root", variant_num=2, confirm_facts="y")
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self.assertTrue("NOTE: Add a total of 3 or more Masters to perform an HA installation." not in result.output)
开发者ID:amon-ra,项目名称:openshift-ansible,代码行数:9,代码来源:cli_installer_tests.py
示例10: test_ha_reuse_master_as_lb
def test_ha_reuse_master_as_lb(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', True, False),
('10.0.0.3', False, False),
('10.0.0.4', True, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
master_lb=(['10.0.0.2', '10.0.0.5'], False))
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args,
input=cli_input)
self.assert_result(result, 0)
开发者ID:claytonspinner,项目名称:openshift-ansible,代码行数:17,代码来源:cli_installer_tests.py
示例11: test_fresh_install_with_config
def test_fresh_install_with_config(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS, 0)
run_playbook_mock.return_value = 0
config_file = self.write_config(
os.path.join(self.work_dir, "ooinstall.conf"), SAMPLE_CONFIG % "openshift-enterprise"
)
cli_input = build_input(confirm_facts="y")
self.cli_args.extend(["-c", config_file])
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 3, 3)
written_config = read_yaml(config_file)
self._verify_config_hosts(written_config, 3)
开发者ID:nicodenis,项目名称:openshift-ansible,代码行数:18,代码来源:cli_installer_tests.py
示例12: test_ha_reuse_master_as_lb
def test_ha_reuse_master_as_lb(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(
hosts=[
("10.0.0.1", True, False),
("10.0.0.2", True, False),
("10.0.0.3", False, False),
("10.0.0.4", True, False),
],
ssh_user="root",
variant_num=1,
confirm_facts="y",
master_lb=(["10.0.0.2", "10.0.0.5"], False),
)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
开发者ID:amon-ra,项目名称:openshift-ansible,代码行数:19,代码来源:cli_installer_tests.py
示例13: test_get_hosts_to_run_on
def test_get_hosts_to_run_on(self, load_facts_mock, run_playbook_mock):
mock_facts = copy.deepcopy(MOCK_FACTS)
mock_facts['10.0.0.1']['common']['version'] = "3.0.0"
mock_facts['10.0.0.2']['common']['version'] = "3.0.0"
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
],
add_nodes=[('10.0.0.2', False, False)],
ssh_user='root',
variant_num=1,
schedulable_masters_ok=True,
confirm_facts='y')
self._verify_get_hosts_to_run_on(mock_facts, load_facts_mock,
run_playbook_mock,
cli_input,
exp_hosts_len=2,
exp_hosts_to_run_on_len=2,
force=False)
开发者ID:claytonspinner,项目名称:openshift-ansible,代码行数:20,代码来源:cli_installer_tests.py
示例14: test_ha_dedicated_node
def test_ha_dedicated_node(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(hosts=[
('10.0.0.1', True, False),
('10.0.0.2', True, False),
('10.0.0.3', True, False),
('10.0.0.4', False, False)],
ssh_user='root',
variant_num=1,
confirm_facts='y',
master_lb=('10.0.0.5', False),
storage='10.1.0.1',)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args,
input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 6, 6)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 6)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
self.assertEquals('False',
inventory.get('nodes', '10.0.0.1 openshift_schedulable'))
self.assertEquals('False',
inventory.get('nodes', '10.0.0.2 openshift_schedulable'))
self.assertEquals('False',
inventory.get('nodes', '10.0.0.3 openshift_schedulable'))
self.assertEquals(None,
inventory.get('nodes', '10.0.0.4'))
self.assertTrue(inventory.has_section('etcd'))
self.assertEquals(3, len(inventory.items('etcd')))
开发者ID:BlueShells,项目名称:openshift-ansible,代码行数:38,代码来源:cli_installer_tests.py
示例15: test_get_hosts_to_run_on
def test_get_hosts_to_run_on(self, load_facts_mock, run_playbook_mock):
mock_facts = copy.deepcopy(MOCK_FACTS)
mock_facts["10.0.0.1"]["common"]["version"] = "3.0.0"
mock_facts["10.0.0.2"]["common"]["version"] = "3.0.0"
cli_input = build_input(
hosts=[("10.0.0.1", True, False)],
add_nodes=[("10.0.0.2", False, False)],
ssh_user="root",
variant_num=1,
schedulable_masters_ok=True,
confirm_facts="y",
)
self._verify_get_hosts_to_run_on(
mock_facts,
load_facts_mock,
run_playbook_mock,
cli_input,
exp_hosts_len=2,
exp_hosts_to_run_on_len=2,
force=False,
)
开发者ID:amon-ra,项目名称:openshift-ansible,代码行数:23,代码来源:cli_installer_tests.py
示例16: test_ha_dedicated_node
def test_ha_dedicated_node(self, load_facts_mock, run_playbook_mock):
load_facts_mock.return_value = (MOCK_FACTS_QUICKHA, 0)
run_playbook_mock.return_value = 0
cli_input = build_input(
hosts=[
("10.0.0.1", True, False),
("10.0.0.2", True, False),
("10.0.0.3", True, False),
("10.0.0.4", False, False),
],
ssh_user="root",
variant_num=1,
confirm_facts="y",
master_lb=("10.0.0.5", False),
storage="10.1.0.1",
)
self.cli_args.append("install")
result = self.runner.invoke(cli.cli, self.cli_args, input=cli_input)
self.assert_result(result, 0)
self._verify_load_facts(load_facts_mock)
self._verify_run_playbook(run_playbook_mock, 6, 6)
written_config = read_yaml(self.config_file)
self._verify_config_hosts(written_config, 6)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
inventory.read(os.path.join(self.work_dir, "hosts"))
self.assert_inventory_host_var(inventory, "nodes", "10.0.0.1", "openshift_schedulable=False")
self.assert_inventory_host_var(inventory, "nodes", "10.0.0.2", "openshift_schedulable=False")
self.assert_inventory_host_var(inventory, "nodes", "10.0.0.3", "openshift_schedulable=False")
self.assert_inventory_host_var_unset(inventory, "nodes", "10.0.0.4", "openshift_schedulable")
self.assertTrue(inventory.has_section("etcd"))
self.assertEquals(3, len(inventory.items("etcd")))
开发者ID:nicodenis,项目名称:openshift-ansible,代码行数:36,代码来源:cli_installer_tests.py
注:本文中的test.fixture.build_input函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论