Skip to content

Commit

Permalink
test: Add more tests for getTransformationFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Oct 8, 2024
1 parent dce673e commit 836e34c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/DIRAC/TransformationSystem/Client/TransformationClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,14 @@ def getTransformationFiles(
res = rpcClient.getTransformationFiles(
condDict, older, newer, timeStamp, orderAttribute, offset, maxfiles, columns
)
# TransformationDB.getTransformationFiles includes a "Records"/"ParameterNames"
# that we don't want to return to the client so explicitly return S_OK with the value
if not res["OK"]:
return res
return S_OK(res["Value"])

# If LFNs requested continue to do the old behavior of requesting in small batches
# Probably not needed?
# If LFNs requested, request in small batches, because...
# Probably not needed? Because this should always be a list
if isinstance(condDict["LFN"], str):
lfnList = [condDict["LFN"]]
else:
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/TransformationSystem/DB/TransformationDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def getTransformationFiles(
else:
return S_ERROR(f"Invalid key {key} in condDict")
if timeStamp:
timeStamp = f"t.{timeStamp}"
timeStamp = f"tf.{timeStamp}"
if fixedCondDict or older or newer:
cond = self.buildCondition(fixedCondDict, older, newer, timeStamp, orderAttribute, limit, offset=offset)
# When buildCondition tries to quote the column names, it will fail due to the table alias
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ def test_addTasksAndFiles(self):
for f in res["Value"]:
self.assertEqual(f["Status"], TransformationFilesStatus.ASSIGNED)

# make sure we can selectively select LFNs
res = self.transClient.getTransformationFiles({"TransformationID": transID, "LFN": ["/aa/lfn.1.txt"]})
assert res["OK"], res
assert len(res["Value"]) == 1, res
assert "TargetSE" in res["Value"][0].keys(), res

# make sure we can selectively select columns
res = self.transClient.getTransformationFiles({"TransformationID": transID}, columns=["LFN", "Status"])
assert res["OK"], res
assert sorted(res["Value"][0]) == ["LFN", "Status"], res

# now adding a new Transformation with new tasks, and introducing a mix of insertion,
# to test that the trigger works as it should
res = self.transClient.addTransformation(
Expand Down

0 comments on commit 836e34c

Please sign in to comment.