summaryrefslogtreecommitdiff
path: root/tests/artifactcache/cache_size.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/artifactcache/cache_size.py')
-rw-r--r--tests/artifactcache/cache_size.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/artifactcache/cache_size.py b/tests/artifactcache/cache_size.py
index 0d12cda8c..63ab9ad07 100644
--- a/tests/artifactcache/cache_size.py
+++ b/tests/artifactcache/cache_size.py
@@ -1,8 +1,10 @@
import os
import pytest
+from unittest import mock
from buildstream import _yaml
from buildstream._artifactcache import CACHE_SIZE_FILE
+from buildstream._exceptions import ErrorDomain
from tests.testutils import cli, create_element_size
@@ -60,3 +62,29 @@ def test_cache_size_write(cli, tmpdir):
with open(sizefile, "r") as f:
size_data = f.read()
size = int(size_data)
+
+
+def test_quota_over_1024T(cli, tmpdir):
+ KiB = 1024
+ MiB = (KiB * 1024)
+ GiB = (MiB * 1024)
+ TiB = (GiB * 1024)
+
+ cli.configure({
+ 'cache': {
+ 'quota': 2048 * TiB
+ }
+ })
+ project = tmpdir.join("main")
+ os.makedirs(str(project))
+ _yaml.dump({'name': 'main'}, str(project.join("project.conf")))
+
+ volume_space_patch = mock.patch(
+ "buildstream._artifactcache.ArtifactCache._get_cache_volume_size",
+ autospec=True,
+ return_value=(1025 * TiB, 1025 * TiB)
+ )
+
+ with volume_space_patch:
+ result = cli.run(project, args=["build", "file.bst"])
+ result.assert_main_error(ErrorDomain.ARTIFACT, 'insufficient-storage-for-quota')