You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:29:59 UTC

[buildstream] 01/03: Add tests for checking the working of a remote cache

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch willsalmon/remotecache
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 018362113130035f96e5b2857eaa048bfee161d3
Author: William Salmon <wi...@codethink.co.uk>
AuthorDate: Thu Jul 23 17:30:32 2020 +0100

    Add tests for checking the working of a remote cache
    
    These basic tests are ment to be run with a remote cache and can be used
    to check bst conpatiblity with a remote cache server.
---
 setup.cfg                                          |   1 +
 tests/conftest.py                                  |  11 +++
 .../project/elements/autotools/amhello.bst         |  26 +++++++
 tests/remotecache/project/elements/base.bst        |   5 ++
 .../project/elements/base/base-alpine.bst          |  17 +++++
 .../elements/build-shell/buildtree-fail.bst        |  13 ++++
 .../project/elements/build-shell/buildtree.bst     |  11 +++
 .../project/elements/no-runtime-deps.bst           |   9 +++
 tests/remotecache/project/files/amhello.tar.gz     | Bin 0 -> 30555 bytes
 .../project/files/dev-files/usr/include/pony.h     |  12 ++++
 .../sub-project/elements/autotools/amhello.bst     |  10 +++
 .../project/files/sub-project/elements/base.bst    |   5 ++
 .../sub-project/elements/base/base-alpine.bst      |  17 +++++
 .../project/files/sub-project/files/amhello.tar.gz | Bin 0 -> 30555 bytes
 .../project/files/sub-project/project.conf         |  27 ++++++++
 tests/remotecache/project/project.conf             |  28 ++++++++
 .../project_nocache/elements/autotools/amhello.bst |  26 +++++++
 .../remotecache/project_nocache/elements/base.bst  |   5 ++
 .../project_nocache/elements/base/base-alpine.bst  |  17 +++++
 .../elements/build-shell/buildtree-fail.bst        |  13 ++++
 .../elements/build-shell/buildtree.bst             |  11 +++
 .../project_nocache/elements/no-runtime-deps.bst   |   9 +++
 .../project_nocache/files/amhello.tar.gz           | Bin 0 -> 30555 bytes
 .../files/dev-files/usr/include/pony.h             |  12 ++++
 .../sub-project/elements/autotools/amhello.bst     |  10 +++
 .../files/sub-project/elements/base.bst            |   5 ++
 .../sub-project/elements/base/base-alpine.bst      |  17 +++++
 .../files/sub-project/files/amhello.tar.gz         | Bin 0 -> 30555 bytes
 .../project_nocache/files/sub-project/project.conf |  27 ++++++++
 tests/remotecache/project_nocache/project.conf     |  28 ++++++++
 tests/remotecache/simple.py                        |  76 +++++++++++++++++++++
 31 files changed, 448 insertions(+)

diff --git a/setup.cfg b/setup.cfg
index 5a3a75d..e8ba5ac 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,6 +18,7 @@ markers =
     datafiles: data files for tests
     integration: run test only if --integration option is specified
     remoteexecution: run test only if --remote-execution option is specified
+    remotecache: run tests only if --remote-cache option is specified
 xfail_strict=True
 
 [mypy]
diff --git a/tests/conftest.py b/tests/conftest.py
index bb4611a..28e120d 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -49,6 +49,7 @@ def pytest_addoption(parser):
     parser.addoption("--integration", action="store_true", default=False, help="Run integration tests")
     parser.addoption("--plugins", action="store_true", default=False, help="Run only plugins tests")
     parser.addoption("--remote-execution", action="store_true", default=False, help="Run remote-execution tests only")
+    parser.addoption("--remote-cache", action="store_true", default=False, help="Run remote-cache tests only")
 
 
 def pytest_runtest_setup(item):
@@ -67,6 +68,16 @@ def pytest_runtest_setup(item):
         if item.get_closest_marker("remoteexecution"):
             pytest.skip("skipping remote-execution test")
 
+    # With --remote-cache: only run tests marked with 'remotecache'
+    if item.config.getvalue("remote_cache"):
+        if not item.get_closest_marker("remotecache"):
+            pytest.skip("skipping non remote-cache test")
+
+    # Without --remote-cache: skip tests marked with 'remotecache'
+    else:
+        if item.get_closest_marker("remotecache"):
+            pytest.skip("skipping remote-cache test")
+
     # With --plugins only run plugins tests
     if item.config.getvalue("plugins"):
         if not item.get_closest_marker("generic_source_test"):
diff --git a/tests/remotecache/project/elements/autotools/amhello.bst b/tests/remotecache/project/elements/autotools/amhello.bst
new file mode 100644
index 0000000..3af67ef
--- /dev/null
+++ b/tests/remotecache/project/elements/autotools/amhello.bst
@@ -0,0 +1,26 @@
+kind: autotools
+description: Autotools test
+
+depends:
+- base.bst
+
+sources:
+- kind: tar
+  url: project_dir:/files/amhello.tar.gz
+  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+
+config:
+
+  configure-commands:
+    - |
+      %{autogen}
+    - |
+      %{configure}
+    - |
+      date +%s > config-time
+
+  build-commands:
+    - |
+      %{make}
+    - |
+      date +%s > build-time
diff --git a/tests/remotecache/project/elements/base.bst b/tests/remotecache/project/elements/base.bst
new file mode 100644
index 0000000..428afa7
--- /dev/null
+++ b/tests/remotecache/project/elements/base.bst
@@ -0,0 +1,5 @@
+# elements/base.bst
+
+kind: stack
+depends:
+  - base/base-alpine.bst
diff --git a/tests/remotecache/project/elements/base/base-alpine.bst b/tests/remotecache/project/elements/base/base-alpine.bst
new file mode 100644
index 0000000..c583309
--- /dev/null
+++ b/tests/remotecache/project/elements/base/base-alpine.bst
@@ -0,0 +1,17 @@
+kind: import
+
+description: |
+  Alpine Linux base for tests
+
+  Generated using the `tests/integration-tests/base/generate-base.sh` script.
+
+sources:
+  - kind: tar
+    base-dir: ''
+    (?):
+    - arch == "x86-64":
+        ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
+        url: "alpine:integration-tests-base.v1.x86_64.tar.xz"
+    - arch == "aarch64":
+        ref: 431fb5362032ede6f172e70a3258354a8fd71fcbdeb1edebc0e20968c792329a
+        url: "alpine:integration-tests-base.v1.aarch64.tar.xz"
diff --git a/tests/remotecache/project/elements/build-shell/buildtree-fail.bst b/tests/remotecache/project/elements/build-shell/buildtree-fail.bst
new file mode 100644
index 0000000..a3b515a
--- /dev/null
+++ b/tests/remotecache/project/elements/build-shell/buildtree-fail.bst
@@ -0,0 +1,13 @@
+kind: manual
+description: |
+  Puts a file in the build tree so that build tree caching and staging can be tested,
+  then deliberately failing to build so we can check the output.
+
+depends:
+  - filename: base.bst
+    type: build
+
+config:
+  build-commands:
+    - "echo 'Hi' > %{build-root}/test"
+    - "false"
diff --git a/tests/remotecache/project/elements/build-shell/buildtree.bst b/tests/remotecache/project/elements/build-shell/buildtree.bst
new file mode 100644
index 0000000..d5cf256
--- /dev/null
+++ b/tests/remotecache/project/elements/build-shell/buildtree.bst
@@ -0,0 +1,11 @@
+kind: manual
+description: |
+  Puts a file in the build tree so that build tree caching and staging can be tested.
+
+depends:
+  - filename: base.bst
+    type: build
+
+config:
+  build-commands:
+    - "echo 'Hi' > %{build-root}/test"
diff --git a/tests/remotecache/project/elements/no-runtime-deps.bst b/tests/remotecache/project/elements/no-runtime-deps.bst
new file mode 100644
index 0000000..ca76aaf
--- /dev/null
+++ b/tests/remotecache/project/elements/no-runtime-deps.bst
@@ -0,0 +1,9 @@
+kind: manual
+description: Test element without runtime dependencies
+
+build-depends:
+- autotools/amhello.bst
+
+config:
+  install-commands:
+  - echo Test > %{install-root}/test
diff --git a/tests/remotecache/project/files/amhello.tar.gz b/tests/remotecache/project/files/amhello.tar.gz
new file mode 100644
index 0000000..afe1899
Binary files /dev/null and b/tests/remotecache/project/files/amhello.tar.gz differ
diff --git a/tests/remotecache/project/files/dev-files/usr/include/pony.h b/tests/remotecache/project/files/dev-files/usr/include/pony.h
new file mode 100644
index 0000000..40bd0c2
--- /dev/null
+++ b/tests/remotecache/project/files/dev-files/usr/include/pony.h
@@ -0,0 +1,12 @@
+#ifndef __PONY_H__
+#define __PONY_H__
+
+#define PONY_BEGIN "Once upon a time, there was a pony."
+#define PONY_END "And they lived happily ever after, the end."
+
+#define MAKE_PONY(story)  \
+  PONY_BEGIN \
+  story \
+  PONY_END
+
+#endif /* __PONY_H__ */
diff --git a/tests/remotecache/project/files/sub-project/elements/autotools/amhello.bst b/tests/remotecache/project/files/sub-project/elements/autotools/amhello.bst
new file mode 100644
index 0000000..ee3a029
--- /dev/null
+++ b/tests/remotecache/project/files/sub-project/elements/autotools/amhello.bst
@@ -0,0 +1,10 @@
+kind: autotools
+description: Autotools test
+
+depends:
+- base.bst
+
+sources:
+- kind: tar
+  url: project_dir:/files/amhello.tar.gz
+  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
diff --git a/tests/remotecache/project/files/sub-project/elements/base.bst b/tests/remotecache/project/files/sub-project/elements/base.bst
new file mode 100644
index 0000000..428afa7
--- /dev/null
+++ b/tests/remotecache/project/files/sub-project/elements/base.bst
@@ -0,0 +1,5 @@
+# elements/base.bst
+
+kind: stack
+depends:
+  - base/base-alpine.bst
diff --git a/tests/remotecache/project/files/sub-project/elements/base/base-alpine.bst b/tests/remotecache/project/files/sub-project/elements/base/base-alpine.bst
new file mode 100644
index 0000000..c583309
--- /dev/null
+++ b/tests/remotecache/project/files/sub-project/elements/base/base-alpine.bst
@@ -0,0 +1,17 @@
+kind: import
+
+description: |
+  Alpine Linux base for tests
+
+  Generated using the `tests/integration-tests/base/generate-base.sh` script.
+
+sources:
+  - kind: tar
+    base-dir: ''
+    (?):
+    - arch == "x86-64":
+        ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
+        url: "alpine:integration-tests-base.v1.x86_64.tar.xz"
+    - arch == "aarch64":
+        ref: 431fb5362032ede6f172e70a3258354a8fd71fcbdeb1edebc0e20968c792329a
+        url: "alpine:integration-tests-base.v1.aarch64.tar.xz"
diff --git a/tests/remotecache/project/files/sub-project/files/amhello.tar.gz b/tests/remotecache/project/files/sub-project/files/amhello.tar.gz
new file mode 100644
index 0000000..afe1899
Binary files /dev/null and b/tests/remotecache/project/files/sub-project/files/amhello.tar.gz differ
diff --git a/tests/remotecache/project/files/sub-project/project.conf b/tests/remotecache/project/files/sub-project/project.conf
new file mode 100644
index 0000000..c8d9e32
--- /dev/null
+++ b/tests/remotecache/project/files/sub-project/project.conf
@@ -0,0 +1,27 @@
+# Project config for frontend build test
+name: subtest
+min-version: 2.0
+
+element-path: elements
+
+aliases:
+  alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/
+  project_dir: file://{project_dir}
+
+options:
+  linux:
+    type: bool
+    description: Whether to expect a linux platform
+    default: True
+  arch:
+    type: arch
+    description: Current architecture
+    values:
+      - x86-64
+      - aarch64
+split-rules:
+  test:
+    - |
+      /tests
+    - |
+      /tests/*
diff --git a/tests/remotecache/project/project.conf b/tests/remotecache/project/project.conf
new file mode 100644
index 0000000..d6c2d1c
--- /dev/null
+++ b/tests/remotecache/project/project.conf
@@ -0,0 +1,28 @@
+# Project config for frontend build test
+name: test
+min-version: 2.0
+element-path: elements
+aliases:
+  alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/
+  project_dir: file://{project_dir}
+options:
+  linux:
+    type: bool
+    description: Whether to expect a linux platform
+    default: True
+  arch:
+    type: arch
+    description: Current architecture
+    values:
+      - x86-64
+      - aarch64
+split-rules:
+  test:
+    - |
+      /tests
+    - |
+      /tests/*
+artifacts:
+  - url: http://docker:50052
+    push: true
+
diff --git a/tests/remotecache/project_nocache/elements/autotools/amhello.bst b/tests/remotecache/project_nocache/elements/autotools/amhello.bst
new file mode 100644
index 0000000..3af67ef
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/autotools/amhello.bst
@@ -0,0 +1,26 @@
+kind: autotools
+description: Autotools test
+
+depends:
+- base.bst
+
+sources:
+- kind: tar
+  url: project_dir:/files/amhello.tar.gz
+  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+
+config:
+
+  configure-commands:
+    - |
+      %{autogen}
+    - |
+      %{configure}
+    - |
+      date +%s > config-time
+
+  build-commands:
+    - |
+      %{make}
+    - |
+      date +%s > build-time
diff --git a/tests/remotecache/project_nocache/elements/base.bst b/tests/remotecache/project_nocache/elements/base.bst
new file mode 100644
index 0000000..428afa7
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/base.bst
@@ -0,0 +1,5 @@
+# elements/base.bst
+
+kind: stack
+depends:
+  - base/base-alpine.bst
diff --git a/tests/remotecache/project_nocache/elements/base/base-alpine.bst b/tests/remotecache/project_nocache/elements/base/base-alpine.bst
new file mode 100644
index 0000000..c583309
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/base/base-alpine.bst
@@ -0,0 +1,17 @@
+kind: import
+
+description: |
+  Alpine Linux base for tests
+
+  Generated using the `tests/integration-tests/base/generate-base.sh` script.
+
+sources:
+  - kind: tar
+    base-dir: ''
+    (?):
+    - arch == "x86-64":
+        ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
+        url: "alpine:integration-tests-base.v1.x86_64.tar.xz"
+    - arch == "aarch64":
+        ref: 431fb5362032ede6f172e70a3258354a8fd71fcbdeb1edebc0e20968c792329a
+        url: "alpine:integration-tests-base.v1.aarch64.tar.xz"
diff --git a/tests/remotecache/project_nocache/elements/build-shell/buildtree-fail.bst b/tests/remotecache/project_nocache/elements/build-shell/buildtree-fail.bst
new file mode 100644
index 0000000..a3b515a
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/build-shell/buildtree-fail.bst
@@ -0,0 +1,13 @@
+kind: manual
+description: |
+  Puts a file in the build tree so that build tree caching and staging can be tested,
+  then deliberately failing to build so we can check the output.
+
+depends:
+  - filename: base.bst
+    type: build
+
+config:
+  build-commands:
+    - "echo 'Hi' > %{build-root}/test"
+    - "false"
diff --git a/tests/remotecache/project_nocache/elements/build-shell/buildtree.bst b/tests/remotecache/project_nocache/elements/build-shell/buildtree.bst
new file mode 100644
index 0000000..d5cf256
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/build-shell/buildtree.bst
@@ -0,0 +1,11 @@
+kind: manual
+description: |
+  Puts a file in the build tree so that build tree caching and staging can be tested.
+
+depends:
+  - filename: base.bst
+    type: build
+
+config:
+  build-commands:
+    - "echo 'Hi' > %{build-root}/test"
diff --git a/tests/remotecache/project_nocache/elements/no-runtime-deps.bst b/tests/remotecache/project_nocache/elements/no-runtime-deps.bst
new file mode 100644
index 0000000..ca76aaf
--- /dev/null
+++ b/tests/remotecache/project_nocache/elements/no-runtime-deps.bst
@@ -0,0 +1,9 @@
+kind: manual
+description: Test element without runtime dependencies
+
+build-depends:
+- autotools/amhello.bst
+
+config:
+  install-commands:
+  - echo Test > %{install-root}/test
diff --git a/tests/remotecache/project_nocache/files/amhello.tar.gz b/tests/remotecache/project_nocache/files/amhello.tar.gz
new file mode 100644
index 0000000..afe1899
Binary files /dev/null and b/tests/remotecache/project_nocache/files/amhello.tar.gz differ
diff --git a/tests/remotecache/project_nocache/files/dev-files/usr/include/pony.h b/tests/remotecache/project_nocache/files/dev-files/usr/include/pony.h
new file mode 100644
index 0000000..40bd0c2
--- /dev/null
+++ b/tests/remotecache/project_nocache/files/dev-files/usr/include/pony.h
@@ -0,0 +1,12 @@
+#ifndef __PONY_H__
+#define __PONY_H__
+
+#define PONY_BEGIN "Once upon a time, there was a pony."
+#define PONY_END "And they lived happily ever after, the end."
+
+#define MAKE_PONY(story)  \
+  PONY_BEGIN \
+  story \
+  PONY_END
+
+#endif /* __PONY_H__ */
diff --git a/tests/remotecache/project_nocache/files/sub-project/elements/autotools/amhello.bst b/tests/remotecache/project_nocache/files/sub-project/elements/autotools/amhello.bst
new file mode 100644
index 0000000..ee3a029
--- /dev/null
+++ b/tests/remotecache/project_nocache/files/sub-project/elements/autotools/amhello.bst
@@ -0,0 +1,10 @@
+kind: autotools
+description: Autotools test
+
+depends:
+- base.bst
+
+sources:
+- kind: tar
+  url: project_dir:/files/amhello.tar.gz
+  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
diff --git a/tests/remotecache/project_nocache/files/sub-project/elements/base.bst b/tests/remotecache/project_nocache/files/sub-project/elements/base.bst
new file mode 100644
index 0000000..428afa7
--- /dev/null
+++ b/tests/remotecache/project_nocache/files/sub-project/elements/base.bst
@@ -0,0 +1,5 @@
+# elements/base.bst
+
+kind: stack
+depends:
+  - base/base-alpine.bst
diff --git a/tests/remotecache/project_nocache/files/sub-project/elements/base/base-alpine.bst b/tests/remotecache/project_nocache/files/sub-project/elements/base/base-alpine.bst
new file mode 100644
index 0000000..c583309
--- /dev/null
+++ b/tests/remotecache/project_nocache/files/sub-project/elements/base/base-alpine.bst
@@ -0,0 +1,17 @@
+kind: import
+
+description: |
+  Alpine Linux base for tests
+
+  Generated using the `tests/integration-tests/base/generate-base.sh` script.
+
+sources:
+  - kind: tar
+    base-dir: ''
+    (?):
+    - arch == "x86-64":
+        ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
+        url: "alpine:integration-tests-base.v1.x86_64.tar.xz"
+    - arch == "aarch64":
+        ref: 431fb5362032ede6f172e70a3258354a8fd71fcbdeb1edebc0e20968c792329a
+        url: "alpine:integration-tests-base.v1.aarch64.tar.xz"
diff --git a/tests/remotecache/project_nocache/files/sub-project/files/amhello.tar.gz b/tests/remotecache/project_nocache/files/sub-project/files/amhello.tar.gz
new file mode 100644
index 0000000..afe1899
Binary files /dev/null and b/tests/remotecache/project_nocache/files/sub-project/files/amhello.tar.gz differ
diff --git a/tests/remotecache/project_nocache/files/sub-project/project.conf b/tests/remotecache/project_nocache/files/sub-project/project.conf
new file mode 100644
index 0000000..c8d9e32
--- /dev/null
+++ b/tests/remotecache/project_nocache/files/sub-project/project.conf
@@ -0,0 +1,27 @@
+# Project config for frontend build test
+name: subtest
+min-version: 2.0
+
+element-path: elements
+
+aliases:
+  alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/
+  project_dir: file://{project_dir}
+
+options:
+  linux:
+    type: bool
+    description: Whether to expect a linux platform
+    default: True
+  arch:
+    type: arch
+    description: Current architecture
+    values:
+      - x86-64
+      - aarch64
+split-rules:
+  test:
+    - |
+      /tests
+    - |
+      /tests/*
diff --git a/tests/remotecache/project_nocache/project.conf b/tests/remotecache/project_nocache/project.conf
new file mode 100644
index 0000000..88b5930
--- /dev/null
+++ b/tests/remotecache/project_nocache/project.conf
@@ -0,0 +1,28 @@
+# Project config for frontend build test
+name: test
+min-version: 2.0
+element-path: elements
+aliases:
+  alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/
+  project_dir: file://{project_dir}
+options:
+  linux:
+    type: bool
+    description: Whether to expect a linux platform
+    default: True
+  arch:
+    type: arch
+    description: Current architecture
+    values:
+      - x86-64
+      - aarch64
+split-rules:
+  test:
+    - |
+      /tests
+    - |
+      /tests/*
+artifacts:
+  - url: http://non_existent_cache:50052
+    push: true
+
diff --git a/tests/remotecache/simple.py b/tests/remotecache/simple.py
new file mode 100644
index 0000000..89faa18
--- /dev/null
+++ b/tests/remotecache/simple.py
@@ -0,0 +1,76 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
+import os
+import pytest
+
+from buildstream.testing import cli_remote_execution as cli  # pylint: disable=unused-import
+from buildstream.testing.integration import assert_contains
+
+
+pytestmark = pytest.mark.remotecache
+
+
+DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
+DATA_DIR_NOCACHE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project_nocache")
+
+
+# Test building an executable with a remote cache:
+@pytest.mark.datafiles(DATA_DIR)
+def test_remote_autotools_build(cli, datafiles):
+    project = str(datafiles)
+    checkout = os.path.join(cli.directory, "checkout")
+    element_name = "autotools/amhello.bst"
+
+    #    services = cli.ensure_services()
+    #   assert set(services) == set(["action-cache", "execution", "storage"])
+
+    result = cli.run(project=project, args=["build", element_name])
+    result.assert_success()
+    assert "INFO    Pushed artifact" in result.stderr
+
+    result = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout])
+    result.assert_success()
+
+    assert_contains(
+        checkout,
+        [
+            "/usr",
+            "/usr/lib",
+            "/usr/bin",
+            "/usr/share",
+            "/usr/bin/hello",
+            "/usr/share/doc",
+            "/usr/share/doc/amhello",
+            "/usr/share/doc/amhello/README",
+        ],
+    )
+
+    # then remove it locally
+    result = cli.run(project=project, args=["artifact", "delete", element_name])
+    result.assert_success()
+
+    result = cli.run(project=project, args=["build", element_name])
+    result.assert_success()
+    assert "INFO    Pulled artifact" in result.stderr
+
+
+# Test building an executable with a remote cache:
+@pytest.mark.datafiles(DATA_DIR_NOCACHE)
+def test_remote_autotools_build_no_cache(cli, datafiles):
+    project = str(datafiles)
+    checkout = os.path.join(cli.directory, "checkout")
+    element_name = "autotools/amhello.bst"
+
+    env = os.environ.copy()
+    env["ARTIFACT_CACHE_SERVICE"] = "http://fake.url.service"
+    result = cli.run(project=project, args=["build", element_name], env=env)
+    result.assert_success()
+
+    assert (
+        """[--:--:--][        ][    main:core activity                 ] WARNING Failed to initialize remote"""
+        in result.stderr
+    )
+    assert (
+        """Remote initialisation failed with status UNAVAILABLE: failed to connect to all addresses""" in result.stderr
+    )