summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-07-01 18:24:51 +0200
committerJürg Billeter <j@bitron.ch>2020-07-06 09:43:22 +0200
commit74c044d31ba0fb122996e3f9272d4b9a22cc98bb (patch)
treea2b26bb6d2f6fb175b77c901fdc91547b290f39d
parent4a2365378e06a5800f62a30a61f8b05a58202e45 (diff)
downloadbuildstream-74c044d31ba0fb122996e3f9272d4b9a22cc98bb.tar.gz
tests/frontend/remote-caches.py: Split test_source_artifact_cachesjuerg/source-push
Use `bst source push` in a new test instead of manually deleting parts of a remote cache.
-rw-r--r--tests/frontend/remote-caches.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/tests/frontend/remote-caches.py b/tests/frontend/remote-caches.py
index b112e0882..ebafddf85 100644
--- a/tests/frontend/remote-caches.py
+++ b/tests/frontend/remote-caches.py
@@ -69,12 +69,34 @@ def test_source_artifact_caches(cli, tmpdir, datafiles):
assert "Pulled artifact " in res.stderr
assert "Pulled source " not in res.stderr
- # remove the artifact from the repo and check it pulls sources, builds
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_source_cache_empty_artifact_cache(cli, tmpdir, datafiles):
+ cachedir = os.path.join(str(tmpdir), "cache")
+ project_dir = str(datafiles)
+ element_path = os.path.join(project_dir, "elements")
+
+ with create_artifact_share(os.path.join(str(tmpdir), "share")) as share:
+ user_config_file = str(tmpdir.join("buildstream.conf"))
+ user_config = {
+ "scheduler": {"pushers": 1},
+ "source-caches": {"url": share.repo, "push": True,},
+ "artifacts": {"url": share.repo, "push": True,},
+ "cachedir": cachedir,
+ }
+ _yaml.roundtrip_dump(user_config, file=user_config_file)
+ cli.configure(user_config)
+
+ create_element_size("repo.bst", project_dir, element_path, [], 10000)
+
+ res = cli.run(project=project_dir, args=["source", "push", "repo.bst"])
+ res.assert_success()
+ assert "Pushed source " in res.stderr
+
+ # delete local sources and check it pulls sources, builds
# and then pushes the artifacts
shutil.rmtree(os.path.join(cachedir, "cas"))
- shutil.rmtree(os.path.join(cachedir, "artifacts"))
- print(os.listdir(os.path.join(share.repodir, "artifacts", "refs")))
- shutil.rmtree(os.path.join(share.repodir, "artifacts", "refs", "test"))
+ shutil.rmtree(os.path.join(cachedir, "sources"))
res = cli.run(project=project_dir, args=["build", "repo.bst"])
res.assert_success()