Пример #1
0
def test_platforms_docker(_model_platforms_docker_section_data, _env, _keep_string):
    assert (
        {}
        == schema_v3.pre_validate(
            _model_platforms_docker_section_data, _env, _keep_string
        )[0]
    )
Пример #2
0
 def _preflight(self, data):
     env = os.environ.copy()
     env = set_env_from_file(env, self.env_file)
     errors, data = schema_v3.pre_validate(data, env, MOLECULE_KEEP_STRING)
     if errors:
         msg = "Failed to pre-validate.\n\n{}".format(errors)
         util.sysexit_with_message(msg, detail=data)
Пример #3
0
def test_has_errors_when_molecule_env_var_referenced_in_unallowed_sections(
        _model_molecule_env_errors_section_data, _env, _keep_string):
    x = {
        "driver": [{
            "name": [
                "cannot reference $MOLECULE special variables in this section",
                "unallowed value $MOLECULE_DRIVER_NAME",
            ]
        }],
        "dependency": [{
            "name": [
                "cannot reference $MOLECULE special variables in this section",
                "unallowed value $MOLECULE_DEPENDENCY_NAME",
            ]
        }],
        "verifier": [{
            "name": [
                "cannot reference $MOLECULE special variables in this section",
                "unallowed value $MOLECULE_VERIFIER_NAME",
            ],
        }],
        "provisioner": [{
            "name": [
                "cannot reference $MOLECULE special variables in this section",
                "unallowed value $MOLECULE_PROVISIONER_NAME",
            ],
        }],
    }

    assert (x == schema_v3.pre_validate(
        _model_molecule_env_errors_section_data, _env, _keep_string)[0])
Пример #4
0
def test_has_errors_when_molecule_env_var_referenced_in_unallowed_sections(
        _model_molecule_env_errors_section_data, _env, _keep_string):
    x = {
        'scenario': [{
            'name':
            ['cannot reference $MOLECULE special variables in this section']
        }],
        'driver': [{
            'name': [
                'cannot reference $MOLECULE special variables in this section',
                'unallowed value $MOLECULE_DRIVER_NAME',
            ]
        }],
        'dependency': [{
            'name': [
                'cannot reference $MOLECULE special variables in this section',
                'unallowed value $MOLECULE_DEPENDENCY_NAME',
            ]
        }],
        'verifier': [{
            'name': [
                'cannot reference $MOLECULE special variables in this section',
                'unallowed value $MOLECULE_VERIFIER_NAME',
            ],
        }],
        'provisioner': [{
            'name': [
                'cannot reference $MOLECULE special variables in this section',
                'unallowed value $MOLECULE_PROVISIONER_NAME',
            ],
        }],
    }

    assert (x == schema_v3.pre_validate(
        _model_molecule_env_errors_section_data, _env, _keep_string)[0])
Пример #5
0
def test_platforms_docker_has_errors(
        _model_platforms_docker_errors_section_data, _env, _keep_string):
    x = {
        'platforms': [{
            0: [{
                'registry': [{
                    'credentials': [{
                        'password': ['must be of string type']
                    }]
                }]
            }]
        }]
    }

    assert (x == schema_v3.pre_validate(
        _model_platforms_docker_errors_section_data, _env, _keep_string)[0])
Пример #6
0
def test_platforms_docker_has_errors(
        _model_platforms_docker_errors_section_data, _env, _keep_string):
    x = {
        "platforms": [{
            0: [{
                "registry": [{
                    "credentials": [{
                        "password": ["must be of string type"]
                    }]
                }]
            }]
        }]
    }

    assert (x == schema_v3.pre_validate(
        _model_platforms_docker_errors_section_data, _env, _keep_string)[0])
Пример #7
0
 def _preflight(self, data: MutableMapping):
     env = set_env_from_file(os.environ.copy(), self.env_file)
     errors, data = schema_v3.pre_validate(data, env, MOLECULE_KEEP_STRING)
     if errors:
         msg = f"Failed to pre-validate.\n\n{errors}"
         util.sysexit_with_message(msg, detail=data)