def mocked_aws_cf(monkeypatch, mocked_test_runner): """Does not include SSH key mocking """ monkeypatch.setattr(test_util.aws.DcosCfStack, '__init__', stub(None)) monkeypatch.setattr( test_util.aws, 'fetch_stack', lambda stack_name, bw: test_util.aws.DcosCfStack(stack_name, bw)) # mock create monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_stack', stub(MockStack())) # mock wait monkeypatch.setattr(test_util.aws.CfStack, 'wait_for_complete', stub(None)) # mock describe monkeypatch.setattr(test_util.aws.DcosCfStack, 'get_master_ips', stub([mock_pub_priv_host])) monkeypatch.setattr(test_util.aws.DcosCfStack, 'get_private_agent_ips', stub([mock_priv_host])) monkeypatch.setattr(test_util.aws.DcosCfStack, 'get_public_agent_ips', stub([mock_pub_priv_host])) # mock delete monkeypatch.setattr(test_util.aws.DcosCfStack, 'delete', stub(None)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_key_pair', stub(None)) # mock config monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_key_pair', stub(launch.util.MOCK_SSH_KEY_DATA))
def mock_bare_cluster_hosts(monkeypatch, mocked_aws_cf, mock_ssher): monkeypatch.setattr(test_util.aws.BareClusterCfStack, '__init__', stub(None)) monkeypatch.setattr(test_util.aws.BareClusterCfStack, 'delete', stub(None)) monkeypatch.setattr(test_util.aws.BareClusterCfStack, 'get_host_ips', stub([mock_pub_priv_host] * 4)) monkeypatch.setattr( test_util.aws, 'fetch_stack', lambda stack_name, bw: test_util.aws.BareClusterCfStack(stack_name, bw)) monkeypatch.setattr(test_util.onprem.OnpremCluster, 'setup_installer_server', stub(None)) monkeypatch.setattr(test_util.onprem.OnpremCluster, 'start_bootstrap_zk', stub(None)) monkeypatch.setattr(test_util.onprem, 'DcosInstallerApiSession', MockInstaller) monkeypatch.setattr(launch.onprem.OnpremLauncher, 'get_last_state', stub(None))
def mocked_azure(monkeypatch, mocked_test_runner): monkeypatch.setattr(test_util.azure.ServicePrincipalCredentials, '__init__', stub(None)) monkeypatch.setattr(test_util.azure.ResourceManagementClient, '__init__', stub(None)) monkeypatch.setattr(test_util.azure.NetworkManagementClient, '__init__', stub(None)) monkeypatch.setattr(test_util.azure.AzureWrapper, 'deploy_template_to_new_resource_group', stub(None)) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'wait_for_deployment', stub(None)) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'delete', stub(None)) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'get_master_ips', stub([mock_pub_priv_host])) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'get_private_agent_ips', stub([mock_priv_host])) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'get_public_agent_ips', stub([mock_pub_priv_host])) monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'public_agent_lb_fqdn', 'abc-foo-bar') monkeypatch.setattr(test_util.azure.DcosAzureResourceGroup, 'public_master_lb_fqdn', 'dead-beef')
def mocked_aws_zen_cf(monkeypatch, mocked_aws_cf): monkeypatch.setattr(test_util.aws.DcosZenCfStack, '__init__', stub(None)) monkeypatch.setattr( test_util.aws, 'fetch_stack', lambda stack_name, bw: test_util.aws.DcosZenCfStack(stack_name, bw)) # mock create monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_vpc_tagged', stub(launch.util.MOCK_VPC_ID)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_internet_gateway_tagged', stub(launch.util.MOCK_GATEWAY_ID)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_subnet_tagged', stub(launch.util.MOCK_SUBNET_ID)) # mock delete monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_subnet', stub(None)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_vpc', stub(None)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_internet_gateway', stub(None)) # mock describe monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_master_ips', stub([Host('127.0.0.1', '12.34.56')])) monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_private_agent_ips', stub([Host('127.0.0.1', None)])) monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_public_agent_ips', stub([Host('127.0.0.1', '12.34.56')])) # mock delete monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'delete', stub(None))
def mocked_test_runner(monkeypatch): monkeypatch.setattr(ssh.tunnel, 'tunnel', mocked_context) monkeypatch.setattr(test_util.runner, 'integration_test', stub(0))
def mocked_aws_zen_cf(monkeypatch, mocked_aws_cf): monkeypatch.setattr(test_util.aws.DcosZenCfStack, '__init__', stub(None)) monkeypatch.setattr( test_util.aws, 'fetch_stack', lambda stack_name, bw: test_util.aws.DcosZenCfStack(stack_name, bw)) # mock create monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_vpc_tagged', stub(launch.util.MOCK_VPC_ID)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_internet_gateway_tagged', stub(launch.util.MOCK_GATEWAY_ID)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'create_subnet_tagged', stub(launch.util.MOCK_SUBNET_ID)) # mock delete monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_subnet', stub(None)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_vpc', stub(None)) monkeypatch.setattr(test_util.aws.BotoWrapper, 'delete_internet_gateway', stub(None)) # mock describe monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_master_ips', stub([mock_pub_priv_host])) monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_private_agent_ips', stub([mock_priv_host])) monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'get_public_agent_ips', stub([mock_pub_priv_host])) # mock delete monkeypatch.setattr(test_util.aws.DcosZenCfStack, 'delete', stub(None))
def mock_ssher(monkeypatch): monkeypatch.setattr(ssh.ssher, 'open_tunnel', mocked_context) monkeypatch.setattr(ssh.ssher.Ssher, 'command', stub(b'')) monkeypatch.setattr(ssh.ssher.Ssher, 'get_home_dir', stub(b''))
def mocked_test_runner(monkeypatch): monkeypatch.setattr(launch.util, 'try_to_output_unbuffered', stub(0))