Esempio n. 1
0
 def test_error_is_skipped_in_nested_config(self, tmpdir):
     get_validated_config(
         get_temp_config_path(tmpdir,
                              'aws-onprem-with-helper.yaml',
                              update={'dcos_config': {
                                  'provider': 'aws'
                              }}))
Esempio n. 2
0
 def test_error_with_invalid_field(self, tmpdir):
     with pytest.raises(LauncherError) as exinfo:
         get_validated_config(
             get_temp_config_path(tmpdir,
                                  'azure-with-helper.yaml',
                                  update={'num_masters': '0.0.0'}))
     assert exinfo.value.error == 'ValidationError'
     assert 'num_masters' in exinfo.value.msg
Esempio n. 3
0
 def test_error_with_invalid_field(self, tmpdir):
     with pytest.raises(LauncherError) as exinfo:
         get_validated_config(
             get_temp_config_path(tmpdir,
                                  'aws-cf-with-helper.yaml',
                                  update={'installer_url': 'foobar'}))
     assert exinfo.value.error == 'ValidationError'
     assert 'installer_url' in exinfo.value.msg
Esempio n. 4
0
 def test_error_with_nested_config(self, tmpdir):
     with pytest.raises(LauncherError) as exinfo:
         get_validated_config(
             get_temp_config_path(tmpdir,
                                  'aws-onprem-with-helper.yaml',
                                  update={
                                      'dcos_config': {
                                          'ip_detect_content': 'foo',
                                          'ip_detect_filename': 'bar'
                                      }
                                  }))
     assert exinfo.value.error == 'ValidationError'
     assert 'ip_detect' in exinfo.value.msg
Esempio n. 5
0
    def test_selinux(self, aws_onprem_config_path):
        config_dir = os.path.dirname(aws_onprem_config_path)

        # [{config values}, expected value of enable_selinux]
        scenarios = [
            [{}, False],
            [{'auto_set_selinux': True}, False],
            [{'auto_set_selinux': True, 'dcos_version': '1.12'}, False],
            [{'auto_set_selinux': True, 'dcos_version': '1.10'}, False],
            [{'auto_set_selinux': False, 'enable_selinux': True, 'dcos_version': '1.10'}, True],
            [{'auto_set_selinux': True, 'installer_url':
                'https://downloads.mesosphere.com/dcos-enterprise/testing/master/dcos_generate_config.ee.sh'}, False],
            [{'auto_set_selinux': True, 'dcos_version': 1.11, 'installer_url':
                'https://downloads.mesosphere.com/dcos-enterprise/testing/master/dcos_generate_config.ee.sh'}, False],
            [{'auto_set_selinux': True, 'dcos_version': 'master', 'installer_url':
                'https://downloads.mesosphere.com/dcos-enterprise/testing/master/dcos_generate_config.ee.sh'}, True],
            [{'auto_set_selinux': True, 'dcos_version': 'master', 'enable_selinux': False, 'installer_url':
                'https://downloads.mesosphere.com/dcos-enterprise/testing/master/dcos_generate_config.ee.sh'}, False],
            [{'auto_set_selinux': False, 'dcos_version': 'master', 'installer_url':
                'https://downloads.mesosphere.com/dcos-enterprise/testing/master/dcos_generate_config.ee.sh'}, False],
        ]

        for s in scenarios:
            values, expected_selinux = s
            with open(aws_onprem_config_path) as f:
                config = yaml.load(f)
                config.update(values)
                config = get_validated_config(config, config_dir)
                assert config['enable_selinux'] is expected_selinux
def onprem_launcher():
    """ Provides the OnpremLauncher to create a cluster for installation.
    """
    launcher = dcos_launch.get_launcher(config.get_validated_config(
        os.environ['TEST_LAUNCH_CONFIG_PATH']))
    if launcher.config['provider'] != 'onprem':
        pytest.skip('Must use a launch config with `provider: onprem` to run this test')
    if launcher.config['platform'] != 'aws':
        pytest.skip('Must use a launch config with `platform: aws` to run this test')
    return launcher
Esempio n. 7
0
 def test_with_key_helper(self, aws_onprem_with_helper_config_path):
     get_validated_config(aws_onprem_with_helper_config_path)
Esempio n. 8
0
 def test_basic(self, aws_onprem_config_path):
     get_validated_config(aws_onprem_config_path)
Esempio n. 9
0
 def test_with_key_helper(self, azure_with_helper_config_path):
     get_validated_config(azure_with_helper_config_path)
Esempio n. 10
0
 def test_basic(self, azure_config_path):
     get_validated_config(azure_config_path)
Esempio n. 11
0
 def test_without_pytest_support(self, aws_cf_no_pytest_config_path):
     get_validated_config(aws_cf_no_pytest_config_path)
Esempio n. 12
0
 def test_with_zen_helper(self, aws_zen_cf_config_path):
     get_validated_config(aws_zen_cf_config_path)
Esempio n. 13
0
 def test_basic(self, gce_onprem_config_path):
     get_validated_config(gce_onprem_config_path)
Esempio n. 14
0
        'master_discovery':
        'static',
        'exhibitor_storage_backend':
        'static',
        'superuser_username':
        os.environ['DCOS_TEST_ADMIN_USERNAME'],
        'superuser_password_hash':
        sha512_crypt.hash(os.environ['DCOS_TEST_ADMIN_PASSWORD']),
        'fault_domain_enabled':
        False,
        'license_key_contents':
        os.environ['DCOS_TEST_LICENSE'],
    },
}

dcos_launch_config = config.get_validated_config(dcos_launch_config, '/tmp')

launcher = get_launcher(dcos_launch_config)

cluster_info = launcher.create()

launcher = get_launcher(cluster_info)
launcher.wait()

# Workaround for `launcher.install_dcos()` printing to stdout.
real_stdout = sys.stdout
sys.stdout = open(os.devnull, "w")
try:
    launcher.install_dcos()
finally:
    sys.stdout.close()