Exemplo n.º 1
0
 def test_main(self, mock_parser, mock_val_args, mock_cross_sets,
               mock_jumphost, mock_json, mock_os,
               mock_deploy_sets, mock_net_sets, mock_net_env,
               mock_utils, mock_parsers, mock_oc_cfg,
               mock_virt_utils, mock_inv, mock_build_vms, mock_uc_lib,
               mock_oc_deploy, mock_shutil, mock_network_data):
     net_sets_dict = {'networks': MagicMock(),
                      'dns_servers': 'test'}
     ds_opts_dict = {'global_params': MagicMock(),
                     'deploy_options': {'gluon': False,
                                        'congress': True,
                                        'sdn_controller': 'opendaylight',
                                        'dataplane': 'ovs',
                                        'sfc': False,
                                        'vpn': False,
                                        'yardstick': 'test',
                                        'os_version': DEFAULT_OS_VERSION,
                                        'containers': False}}
     args = mock_parser.return_value.parse_args.return_value
     args.virtual = False
     args.quickstart = False
     args.debug = False
     args.upstream = False
     net_sets = mock_net_sets.return_value
     net_sets.enabled_network_list = ['external']
     net_sets.__getitem__.side_effect = net_sets_dict.__getitem__
     net_sets.__contains__.side_effect = net_sets_dict.__contains__
     deploy_sets = mock_deploy_sets.return_value
     deploy_sets.__getitem__.side_effect = ds_opts_dict.__getitem__
     deploy_sets.__contains__.side_effect = ds_opts_dict.__contains__
     mock_parsers.parse_nova_output.return_value = {'testnode1': 'test'}
     main()
Exemplo n.º 2
0
 def test_main_qs(self, mock_parser, mock_os, mock_deploy,
                  mock_net_sets, mock_net_env, mock_inv, mock_utils,
                  mock_virt_utils, mock_cross):
     args = mock_parser.return_value.parse_args.return_value
     args.virtual = False
     args.quickstart = True
     args.debug = True
     main()
Exemplo n.º 3
0
 def test_main_snapshot(self, mock_parser, mock_os, mock_deploy,
                        mock_net_sets, mock_net_env, mock_inv, mock_utils,
                        mock_virt_utils, mock_cross, mock_snap_deployment):
     args = mock_parser.return_value.parse_args.return_value
     args.virtual = False
     args.snapshot = True
     args.debug = True
     main()
     mock_snap_deployment.assert_called()
Exemplo n.º 4
0
 def test_main_virt(self, mock_parser, mock_val_args, mock_cross_sets,
                    mock_jumphost, mock_json, mock_os, mock_deploy_sets,
                    mock_net_sets, mock_net_env, mock_utils, mock_parsers,
                    mock_oc_cfg, mock_virt_utils, mock_inv, mock_build_vms,
                    mock_uc_lib, mock_oc_deploy, mock_shutil,
                    mock_network_data, mock_uc_builder, mock_deployment,
                    mock_c_builder):
     # didn't work yet line 412
     # net_sets_dict = {'networks': {'admin': {'cidr': MagicMock()}},
     #                 'dns_servers': 'test'}
     # net_sets_dict['networks']['admin']['cidr'].return_value.version = 6
     ds_opts_dict = {
         'global_params': MagicMock(),
         'deploy_options': {
             'gluon': False,
             'congress': False,
             'sdn_controller': 'opendaylight',
             'dataplane': 'ovs',
             'sfc': False,
             'vpn': False,
             'vim': 'openstack',
             'yardstick': 'test',
             'os_version': DEFAULT_OS_VERSION,
             'containers': False
         }
     }
     args = mock_parser.return_value.parse_args.return_value
     args.virtual = True
     args.quickstart = False
     args.debug = True
     args.virt_default_ram = 10
     args.ha_enabled = True
     args.virt_compute_nodes = 1
     args.virt_compute_ram = None
     args.virt_default_ram = 12
     args.upstream = True
     args.snapshot = False
     net_sets = mock_net_sets.return_value
     net_sets.enabled_network_list = ['admin']
     deploy_sets = mock_deploy_sets.return_value
     deploy_sets.__getitem__.side_effect = ds_opts_dict.__getitem__
     deploy_sets.__contains__.side_effect = ds_opts_dict.__contains__
     main()
     args.virt_compute_ram = 16
     args.virt_default_ram = 10
     main()