Skip to content

Commit

Permalink
show more care in how entities are loaded, to avoid dupes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael S. Noble committed Aug 9, 2018
1 parent e1b75e0 commit e06734e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions firecloud/tests/highlevel_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ def test_attr_workspace(self):
self.assertEqual(result[name], value)

def load_entities(self):
# To potentially save time, check if entities already exist
r = fapi.get_entity(self.project, self.workspace, "sample_set", "SS-NT")
if r.status_code == 200:
# To potentially save time, sanity check if entities already exist
r1 = fapi.get_entity(self.project, self.workspace, "sample_set", "SS-TP")
r2 = fapi.get_entity(self.project, self.workspace, "participant_set", "PARTICIP_SET_2")
if r1.status_code == 200 and r2.status_code == 200:
return

if r.status_code != 404:
raise RuntimeError("while determining if SS-NT sample_set exists")
if r1.status_code not in [404,200] or r2.status_code not in [404,200]:
raise RuntimeError("while checking for sample_set/participant_set")

print("\n\tLoading data entities for tests ...", file=sys.stderr)
args =("entity_import", "-p", self.project, "-w", self.workspace)
Expand Down Expand Up @@ -347,11 +348,11 @@ def test_sample_list(self):
args = ('sample_list', '-p', self.project, '-w', self.workspace)

# Sample set, by way of using default value for -t
result = call_func(*(args + ('-e', 'SS-NT')))
result = call_func(*(args + ('-e', 'SS-TP')))
self.assertEqual(2000, len(result))
self.assertIn('S-0-NT', result)
self.assertIn('S-501-NT', result)
self.assertIn('S-1999-NT',result)
self.assertIn('S-0-TP', result)
self.assertIn('S-501-TP', result)
self.assertIn('S-1999-TP',result)

# Single sample (silly, but FISS aims to tolerate such)
result = call_func(*(args + ('-e', 'S-1000-TP', '-t', 'sample')))
Expand Down

0 comments on commit e06734e

Please sign in to comment.