Exemplo n.º 1
0
def schema():
    base = {
        Required("interactive"): [
            {
                Required("name"): str,
                Required("prompts"): [All(str, Length(min=1))],
                Optional("echo"): "discard",
                Required("script"): [
                    {
                        Required("command"): Any(str, None),
                        Optional("name"): All(str, Length(min=1)),
                        Optional("successes"): [
                            {Required("message"): All(str, Length(min=1))}
                        ],
                        Optional("failures"): [
                            {
                                Required("message"): All(str, Length(min=1)),
                                Optional("exception"): Any(
                                    "InfrastructureError", "JobError", "TestError"
                                ),
                                Optional("error"): All(str, Length(min=1)),
                            }
                        ],
                    }
                ],
            }
        ]
    }
    return {**test.schema(), **base}
Exemplo n.º 2
0
def schema():
    base = {
        Required("interactive"): [
            {
                Required("name"): Match(r"^[-_a-zA-Z0-9.]+$"),
                Required("prompts"): [All(str, Length(min=1))],
                Optional("echo"): "discard",
                Required("script"): [
                    {
                        Optional("command"): Any(str, None),
                        Optional("delay"): int,
                        Optional("lava-send"): str,
                        Optional("lava-sync"): str,
                        Optional("lava-wait"): str,
                        Optional("lava-wait-all"): str,
                        Optional("name"): Match(r"^[-_a-zA-Z0-9.]+$"),
                        Optional("wait_for_prompt"): bool,
                        Optional("successes"): [
                            {Required("message"): All(str, Length(min=1))}
                        ],
                        Optional("failures"): [
                            {
                                Required("message"): All(str, Length(min=1)),
                                Optional("exception"): Any(
                                    "InfrastructureError", "JobError", "TestError"
                                ),
                                Optional("error"): All(str, Length(min=1)),
                            }
                        ],
                    }
                ],
            }
        ]
    }
    return {**test.schema(), **base}
Exemplo n.º 3
0
def schema(live=False):
    common = {
        Required("path"):
        str,
        Required("name"):
        str,
        Optional("skip_install"):
        [Any("keys", "sources", "deps", "steps", "git-repos", "all")],
        # Optional("parameters"):
    }

    base = {
        Required("definitions"): [
            Any(
                {
                    Required("repository"): str,
                    Required("from"): Any("git", "bzr"),
                    Optional("branch"): str,
                    Optional("lava-signal"): Any("kmsg", "stdout"),
                    Optional("history"): bool,
                    Optional("revision"): str,
                    Optional("parameters"): {},
                    Optional("params"): {},
                    **common,
                },
                {
                    Required("repository"): {
                        Required("metadata"): dict,  # TODO: what's required?
                        Optional("install"): {
                            Optional("deps"): [str],
                            Optional(Match(r"deps-.+")): [str],
                            Optional("git-repos"): [str],
                            Optional("keys"): [str],
                            Optional("steps"): [str],
                            Optional("sources"): [str],
                        },
                        Optional("parse"): {
                            Optional("fixupdict"): {
                                str: Any("pass", "fail", "skip", "unknown")
                            }
                        },
                        Optional("run"): {
                            Required("steps"): [str]
                        },
                    },
                    Required("from"): "inline",
                    **common,
                },
            )
        ]
    }
    return {**test.schema(live), **base}
Exemplo n.º 4
0
def schema():
    base = {
        Required("monitors"): [{
            Required("name"): str,
            Required("start"): str,
            Required("end"): str,
            Required("pattern"): str,
            Optional("fixupdict"): {
                str: Any("pass", "fail", "skip", "unknown")
            },
        }]
    }
    return {**test.schema(), **base}
Exemplo n.º 5
0
def schema():
    common = {
        Required("path"): str,
        Required("name"): Match(r"^[-_a-zA-Z0-9.]+$"),
        Optional("skip_install"): [
            Any("keys", "sources", "deps", "steps", "git-repos", "all")
        ],
        # Optional("parameters"):
        Optional("lava-signal"): Any("kmsg", "stdout"),
    }

    base = {
        Required("definitions"): [
            Any(
                {
                    Required("repository"): str,
                    Required("from"): "git",
                    Optional("branch"): str,
                    Optional("history"): bool,
                    Optional("revision"): str,
                    Optional("parameters"): dict,
                    Optional("params"): dict,
                    **common,
                },
                {
                    Required("repository"): str,
                    Required("from"): "url",
                    Required("compression"): str,
                    Optional("parameters"): dict,
                    Optional("params"): dict,
                    **common,
                },
                {
                    Required("repository"): {**testdef()},
                    Required("from"): "inline",
                    **common,
                },
            )
        ]
    }
    return {**test.schema(), **base}
Exemplo n.º 6
0
def schema():
    common = {
        Required("path"):
        str,
        Required("name"):
        Match(r"^[-_a-zA-Z0-9.]+$"),
        Optional("skip_install"):
        [Any("keys", "sources", "deps", "steps", "git-repos", "all")],
        # Optional("parameters"):
        Optional("lava-signal"):
        Any("kmsg", "stdout"),
    }

    base = {
        Required("definitions"): [
            Any(
                {
                    Required("repository"): str,
                    Required("from"): "git",
                    Optional("branch"): str,
                    Optional("history"): bool,
                    Optional("revision"): str,
                    Optional("parameters"): dict,
                    Optional("params"): dict,
                    **common,
                },
                {
                    Required("repository"): {
                        Required("metadata"): {
                            Required("format"):
                            "Lava-Test Test Definition 1.0",
                            Required("name"): str,
                            Optional("description"): str,
                            Optional("environment"): [str],
                            Optional("devices"): [str],
                            Optional("maintainer"): [str],
                            Optional("scope"): [str],
                            Optional("os"): [str],
                        },
                        Optional("install"): {
                            Optional("deps"): [str],
                            Optional(Match(r"deps-.+")): [str],
                            Optional("git-repos"): [str],
                            Optional("keys"): [str],
                            Optional("steps"): [str],
                            Optional("sources"): [str],
                        },
                        Optional("parse"): {
                            Optional("fixupdict"): {
                                str: Any("pass", "fail", "skip", "unknown")
                            }
                        },
                        Optional("run"): {
                            Required("steps"): [str]
                        },
                    },
                    Required("from"): "inline",
                    **common,
                },
            )
        ]
    }
    return {**test.schema(), **base}