コード例 #1
0
    def test_group_doc_to_dict(self):
        test_group = mtgroup.TestGroupDocument("name", "lab-name")

        test_group.arch = "arm"
        test_group.board = "board"
        test_group.board_instance = 1
        test_group.boot_log = "boot-log"
        test_group.boot_log_html = "boot-log-html"
        test_group.boot_result_description = "boot-result-description"
        test_group.build_id = "build-id"
        test_group.compiler = "gcc"
        test_group.compiler_version = "4.7.3"
        test_group.compiler_version_full = "gcc version 4.7.3"
        test_group.created_on = "now"
        test_group.cross_compile = "cross-compile"
        test_group.defconfig = "defconfig"
        test_group.defconfig_full = "defconfig-full"
        test_group.definition_uri = "uri"
        test_group.device_type = "device-type"
        test_group.dtb = "dtb"
        test_group.dtb_addr = "dtb-addr"
        test_group.endian = "big-endian"
        test_group.file_server_resource = "file-resource"
        test_group.file_server_url = "file-url"
        test_group.git_branch = "git-branch"
        test_group.git_commit = "git-commit"
        test_group.git_describe = "git-describe"
        test_group.git_url = "git-url"
        test_group.id = "id"
        test_group.image_type = "image_type"
        test_group.initrd = "initrd"
        test_group.initrd_addr = "initrd-addr"
        test_group.initrd_info = "initrd-info"
        test_group.job = "job"
        test_group.job_id = "job_id"
        test_group.kernel = "kernel"
        test_group.kernel_image = "kernel-image"
        test_group.kernel_image_size = "kernel-image-size"
        test_group.load_addr = "load-addr"
        test_group.mach = "mach"
        test_group.metadata = {"foo": "bar"}
        test_group.qemu = "qemu"
        test_group.qemu_command = "qemu-command"
        test_group.retries = 2
        test_group.sub_groups = [True, False]
        test_group.test_cases = ["foo"]
        test_group.time = 10
        test_group.vcs_commit = "1234"
        test_group.version = "1.1"
        test_group.warnings = 123

        expected = {
            "_id": "id",
            "arch": "arm",
            "board": "board",
            "board_instance": 1,
            "boot_log": "boot-log",
            "boot_log_html": "boot-log-html",
            "boot_result_description": "boot-result-description",
            "build_id": "build-id",
            "compiler": "gcc",
            "compiler_version": "4.7.3",
            "compiler_version_full": "gcc version 4.7.3",
            "created_on": "now",
            "cross_compile": "cross-compile",
            "defconfig": "defconfig",
            "defconfig_full": "defconfig-full",
            "definition_uri": "uri",
            "device_type": "device-type",
            "dtb": "dtb",
            "dtb_addr": "dtb-addr",
            "endian": "big-endian",
            "file_server_resource": "file-resource",
            "file_server_url": "file-url",
            "git_branch": "git-branch",
            "git_commit": "git-commit",
            "git_describe": "git-describe",
            "git_url": "git-url",
            "image_type": "image_type",
            "initrd": "initrd",
            "initrd_addr": "initrd-addr",
            "initrd_info": "initrd-info",
            "job": "job",
            "job_id": "job_id",
            "kernel": "kernel",
            "kernel_image": "kernel-image",
            "kernel_image_size": "kernel-image-size",
            "lab_name": "lab-name",
            "load_addr": "load-addr",
            "mach": "mach",
            "metadata": {
                "foo": "bar"
            },
            "name": "name",
            "qemu": "qemu",
            "qemu_command": "qemu-command",
            "retries": 2,
            "sub_groups": [True, False],
            "test_cases": ["foo"],
            "time": 10,
            "vcs_commit": "1234",
            "version": "1.1",
            "warnings": 123,
        }

        self.assertDictEqual(expected, test_group.to_dict())
コード例 #2
0
ファイル: __init__.py プロジェクト: ana/kernelci-backend
    except KeyError, ex:
        err_msg = "Missing mandatory key in test group data"
        utils.LOG.exception(ex)
        utils.LOG.error(err_msg)
        ERR_ADD(errors, 400, err_msg)
        return None

    arch = test_json.get(models.ARCHITECTURE_KEY)

    if arch not in models.VALID_ARCHITECTURES:
        err_msg = "Invalid architecture found: %s".format(arch)
        utils.LOG.error(err_msg)
        ERR_ADD(errors, 400, err_msg)
        return None

    test_doc = mtest_group.TestGroupDocument(name, lab_name)
    test_doc.created_on = datetime.datetime.now(tz=bson.tz_util.utc)
    _update_test_group_doc_from_json(test_doc, test_json, errors)
    _update_test_group_doc_ids(test_doc, database)
    return test_doc


def import_and_save_test_cases(group_doc_id, group_name, test_cases, database,
                               errors):
    """Import the tests cases from a JSON object into a group.

    Parse the test_cases JSON data into a list of test cases, add them to the
    database and update the related test group.

    This function returns an operation code based on the import result
    of all the test cases.
コード例 #3
0
 def test_group_doc_valid_instance(self):
     test_group = mtgroup.TestGroupDocument("name", "lab-name")
     self.assertIsInstance(test_group, mbase.BaseDocument)
コード例 #4
0
    def test_group_doc_to_dict(self):
        test_group = mtgroup.TestGroupDocument("name", "lab-name")

        test_group.arch = "arm"
        test_group.board_instance = 1
        test_group.boot_log = "boot-log"
        test_group.boot_log_html = "boot-log-html"
        test_group.boot_result_description = "boot-result-description"
        test_group.build_environment = "build-environment"
        test_group.build_id = "build-id"
        test_group.compiler = "gcc"
        test_group.compiler_version = "4.7.3"
        test_group.compiler_version_full = "gcc version 4.7.3"
        test_group.created_on = "now"
        test_group.cross_compile = "cross-compile"
        test_group.defconfig = "defconfig"
        test_group.defconfig_full = "defconfig-full"
        test_group.device_type = "device-type"
        test_group.dtb = "dtb"
        test_group.endian = "big-endian"
        test_group.file_server_resource = "file-resource"
        test_group.git_branch = "git-branch"
        test_group.git_commit = "git-commit"
        test_group.git_describe = "git-describe"
        test_group.git_url = "git-url"
        test_group.id = "id"
        test_group.index = 1
        test_group.initrd = "initrd"
        test_group.initrd_info = "initrd-info"
        test_group.job = "job"
        test_group.job_id = "job_id"
        test_group.kernel = "kernel"
        test_group.kernel_image = "kernel-image"
        test_group.mach = "mach"
        test_group.modules = "moduli"
        test_group.parent_id = "parent-id"
        test_group.plan_variant = "tother"
        test_group.sub_groups = [True, False]
        test_group.test_cases = ["foo"]
        test_group.time = 10
        test_group.version = "1.1"
        test_group.warnings = 123

        expected = {
            "_id": "id",
            "arch": "arm",
            "board_instance": 1,
            "boot_log": "boot-log",
            "boot_log_html": "boot-log-html",
            "boot_result_description": "boot-result-description",
            "build_environment": "build-environment",
            "build_id": "build-id",
            "compiler": "gcc",
            "compiler_version": "4.7.3",
            "compiler_version_full": "gcc version 4.7.3",
            "created_on": "now",
            "cross_compile": "cross-compile",
            "defconfig": "defconfig",
            "defconfig_full": "defconfig-full",
            "device_type": "device-type",
            "dtb": "dtb",
            "endian": "big-endian",
            "file_server_resource": "file-resource",
            "git_branch": "git-branch",
            "git_commit": "git-commit",
            "git_describe": "git-describe",
            "git_url": "git-url",
            "index": 1,
            "initrd": "initrd",
            "initrd_info": "initrd-info",
            "job": "job",
            "job_id": "job_id",
            "kernel": "kernel",
            "kernel_image": "kernel-image",
            "lab_name": "lab-name",
            "mach": "mach",
            "modules": "moduli",
            "parent_id": "parent-id",
            "plan_variant": "tother",
            "name": "name",
            "sub_groups": [True, False],
            "test_cases": ["foo"],
            "time": 10,
            "version": "1.1",
            "warnings": 123,
        }

        self.assertDictEqual(expected, test_group.to_dict())