Skip to content
This repository was archived by the owner on Dec 4, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/infra/base_smoketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class BaseSmokeTest(unittest.TestCase):
}
]
notification_bucket = os.environ['DSS_S3_BUCKET_TEST']
scripts_dir = os.path.join(os.getenv('DSS_HOME'), 'scripts')

@classmethod
def setUpClass(cls):
Expand Down Expand Up @@ -238,6 +239,18 @@ def _test_get_subscriptions(self, replica, requested_subscription, subscription_
list_of_subscription_uuids = [x['uuid'] for x in list_of_subscriptions if x['uuid']]
self.assertIn(requested_subscription, list_of_subscription_uuids)

def add_to_flac_table(self, keys: list, groups: list):
"""adds given uuid to the flac lookup table"""
return run_for_json(f'{self.scripts_dir}/dss-ops.py flac add --keys {" ".join(keys)}'
f' --groups {" ".join(groups)}')

def cleanup_from_flac_table(self, keys: list):
self.addCleanup(run, f'{self.scripts_dir}/dss-ops.py flac remove --keys {" ".join(keys)}')

def get_from_flac_table(self, keys: list):
"""adds given uuid to the flac lookup table"""
return run_for_json(f'{self.scripts_dir}/dss-ops.py flac get --keys {" ".join(keys)}')

@staticmethod
def _download_bundle(replica_name: str, bundle_uuid: str, workdir: str, venv_bin: str):
with tempfile.TemporaryDirectory(prefix=f'{workdir}/') as tempdir:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_smoketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def smoketest(self, starting_replica, checkout_bucket, test_bucket):
version=bundle_version):
self._test_replay_event(replica, bundle_uuid, bundle_version)

with self.subTest(f'Testing FLAC Lookup for bundles'):
keys = [f'bundles/{bundle_uuid}.{bundle_version}']
self.add_to_flac_table(keys=keys, groups=['service-account', 'dss_admin'])
added_bundles = self.get_from_flac_table(keys=keys)
self.cleanup_from_flac_table(keys=keys)
self.assertIs(True, added_bundles[0].get('inDatabase'))
for replica in self.replicas:
self._test_get_bundle(replica=replica, bundle_uuid=bundle_uuid)
self.add_to_flac_table(keys=keys, groups=['deny'])
for replica in self.replicas:
self._test_get_bundle(replica=replica, bundle_uuid=bundle_uuid)
# This is going to cause a error in the subprocess, can this be caught because
# its expected? what would be the appropriate way to perform this?

for replica in self.replicas:
with self.subTest(f"{starting_replica.name}: Tombstone the bundle on replica {replica}"):
run_for_json(f"{self.venv_bin}dbio dss delete-bundle --uuid {bundle_uuid} --version {bundle_version} "
Expand Down