diff options
Diffstat (limited to 'molecule/default/tests')
| -rw-r--r-- | molecule/default/tests/test_server_setup.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/molecule/default/tests/test_server_setup.py b/molecule/default/tests/test_server_setup.py index 5ec1520..0a987b2 100644 --- a/molecule/default/tests/test_server_setup.py +++ b/molecule/default/tests/test_server_setup.py @@ -120,6 +120,39 @@ class TestBorgSSHSetup: 'borg-client-multi should NOT have access to borg-client-2 repo' ) + def test_authorized_keys_has_storage_quota(self, host): + """Verify storage quota is set in authorized_keys for configured repos""" + auth_keys = host.file('/opt/borg/.ssh/authorized_keys') + content = auth_keys.content_string + + quotas = re.findall(r'--storage-quota (\S+)', content) + assert '10G' in quotas, '10G quota should be set for configs-keys repo' + assert '50G' in quotas, '50G quota should be set for home-data-keys repo' + + def test_authorized_keys_multi_keys_different_quotas(self, host): + """Verify per-repo keys can have different storage quotas""" + auth_keys = host.file('/opt/borg/.ssh/authorized_keys') + content = auth_keys.content_string + + multi_keys_lines = [ + line for line in content.split('\n') + if line and 'root@borg-client-multi-keys' in line + ] + + assert len(multi_keys_lines) == 2, ( + f"Should have two entries for borg-client-multi-keys, found {len(multi_keys_lines)}" + ) + + configs_line = [l for l in multi_keys_lines if 'configs-keys' in l][0] + home_data_line = [l for l in multi_keys_lines if 'home-data-keys' in l][0] + + assert '--storage-quota 10G' in configs_line, ( + 'configs-keys should have 10G quota' + ) + assert '--storage-quota 50G' in home_data_line, ( + 'home-data-keys should have 50G quota' + ) + class TestBorgRepository: def test_repo_directory_exists(self, host): |