Skip to content

Commit

Permalink
Prevent resource conflicts in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Dec 27, 2024
1 parent 946a0a7 commit b61fbbf
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 65 deletions.
22 changes: 11 additions & 11 deletions tests/integ/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def testCompound(self):
self.assertTrue(helper.validateId(dset_uuid))

# link the new dataset
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def testAutoChunk1dDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1686,7 +1686,7 @@ def testAutoChunk2dDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1743,7 +1743,7 @@ def testMinChunkSizeDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2138,7 +2138,7 @@ def testContiguousRefDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2216,7 +2216,7 @@ def testContiguousRefZeroDimDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2301,7 +2301,7 @@ def testChunkedRefDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2385,7 +2385,7 @@ def testChunkedRefIndirectDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2481,7 +2481,7 @@ def testChunkedRefIndirectS3UriDataset(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2542,7 +2542,7 @@ def testDatasetChunkPartitioning(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -2605,7 +2605,7 @@ def testExtendibleDatasetChunkPartitioning(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down
12 changes: 6 additions & 6 deletions tests/integ/filter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def testDeflateCompression(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -129,7 +129,7 @@ def testShuffleFilter(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -191,7 +191,7 @@ def testShuffleAndDeflate(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -246,7 +246,7 @@ def testBitShuffle(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -308,7 +308,7 @@ def testBitShuffleAndDeflate(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -493,7 +493,7 @@ def testBitDeshuffling(self):
rspJson = json.loads(rsp.text)
dset_uuid = rspJson["id"]
self.assertTrue(helper.validateId(dset_uuid))
req = self.endpoint + "/groups/" + root_uuid + "/links/" + "dset"
req = self.endpoint + "/groups/" + root_uuid + "/links/" + "dset" + helper.getRandomName()
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
self.assertEqual(rsp.status_code, 201, rsp.text)
Expand Down
6 changes: 6 additions & 0 deletions tests/integ/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def getTestDomainName(name):
return domain


def getRandomName():
"""Return a random name"""
random_str = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))
return random_str


def getRequestHeaders(domain=None, username=None, bucket=None, password=None, **kwargs):
"""Get default request headers for domain"""
if username is None:
Expand Down
16 changes: 8 additions & 8 deletions tests/integ/pointsel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def testPost1DDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset1d'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -287,7 +287,7 @@ def testPost1DDatasetBinary(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset1d'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -685,7 +685,7 @@ def testPostChunkedRefDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -836,7 +836,7 @@ def testPostChunkedRefIndirectDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -895,7 +895,7 @@ def testPut1DDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset1d'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def testPut1DDatasetBinary(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset1d'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def testPut1DDatasetVlenBinary(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset1d'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -1729,7 +1729,7 @@ def testPostCompoundDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset_compound'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down
6 changes: 3 additions & 3 deletions tests/integ/query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def testSimpleQuery(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset1'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -388,7 +388,7 @@ def testChunkedRefIndirectDataset(self):
self.assertTrue(helper.validateId(dset_id))

# link new dataset as 'dset'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_id}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down Expand Up @@ -459,7 +459,7 @@ def testPutQuery(self):
self.assertTrue(helper.validateId(dset_uuid))

# link new dataset as 'dset1'
name = "dset"
name = "dset" + helper.getRandomName()
req = self.endpoint + "/groups/" + root_uuid + "/links/" + name
payload = {"id": dset_uuid}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
Expand Down
Loading

0 comments on commit b61fbbf

Please sign in to comment.