Exemplo n.º 1
0
def test_buildtree_remote(cli, tmpdir, datafiles):
    project = str(datafiles)
    element_name = "build-shell/buildtree.bst"
    share_path = os.path.join(str(tmpdir), "share")

    services = cli.ensure_services()
    assert set(services) == set(["action-cache", "execution", "storage"])

    with create_artifact_share(share_path) as share:
        cli.configure({
            "artifacts": {
                "servers": [{
                    "url": share.repo,
                    "push": True
                }]
            },
            "cache": {
                "pull-buildtrees": False
            }
        })

        res = cli.run(
            project=project,
            args=["--cache-buildtrees", "always", "build", element_name])
        res.assert_success()

        # remove local cache
        shutil.rmtree(os.path.join(str(tmpdir), "cache", "cas"))
        shutil.rmtree(os.path.join(str(tmpdir), "cache", "artifacts"))

        # pull without buildtree
        res = cli.run(project=project,
                      args=["artifact", "pull", "--deps", "all", element_name])
        res.assert_success()

        # check shell doesn't work
        res = cli.run(
            project=project,
            args=["shell", "--build", element_name, "--", "cat", "test"])
        res.assert_shell_error()

        # pull with buildtree
        res = cli.run(project=project,
                      args=[
                          "--pull-buildtrees", "artifact", "pull", "--deps",
                          "all", element_name
                      ])
        res.assert_success()

        # check it works this time
        res = cli.run(project=project,
                      args=[
                          "shell", "--build", element_name, "--use-buildtree",
                          "--", "cat", "test"
                      ])
        res.assert_success()
        assert "Hi" in res.output
Exemplo n.º 2
0
def test_remote_autotools_build_no_cache(cli, datafiles):
    project = str(datafiles)
    checkout = os.path.join(cli.directory, "checkout")
    element_name = "autotools/amhello.bst"

    cli.configure({"artifacts": {"servers": [{"url": "http://fake.url.service", "push": True}]}})
    result = cli.run(project=project, args=["build", element_name])
    result.assert_success()

    assert """WARNING Failed to initialize remote""" in result.stderr
    assert """Remote initialisation failed with status UNAVAILABLE: DNS resolution failed""" in result.stderr
Exemplo n.º 3
0
def test_build_dependency_partial_local_cas(cli, datafiles,
                                            pull_artifact_files, build_all):
    project = str(datafiles)
    element_name = "no-runtime-deps.bst"
    builddep_element_name = "autotools/amhello.bst"
    checkout = os.path.join(cli.directory, "checkout")
    builddep_checkout = os.path.join(cli.directory, "builddep-checkout")

    services = cli.ensure_services()
    assert set(services) == set(["action-cache", "execution", "storage"])

    # configure pull blobs
    if build_all:
        cli.configure({"build": {"dependencies": "all"}})
    cli.config["remote-execution"]["pull-artifact-files"] = pull_artifact_files

    result = cli.run(project=project, args=["build", element_name])
    result.assert_success()

    # Verify artifact is pulled bar files when ensure artifact files is set
    result = cli.run(
        project=project,
        args=["artifact", "checkout", element_name, "--directory", checkout])
    if pull_artifact_files:
        result.assert_success()
        assert_contains(checkout, ["/test"])
    else:
        result.assert_main_error(ErrorDomain.STREAM,
                                 "uncached-checkout-attempt")

    # Verify build dependencies is pulled for ALL and BUILD
    result = cli.run(project=project,
                     args=[
                         "artifact", "checkout", builddep_element_name,
                         "--directory", builddep_checkout
                     ])
    if build_all and pull_artifact_files:
        result.assert_success()
    else:
        result.assert_main_error(ErrorDomain.STREAM,
                                 "uncached-checkout-attempt")