Skip to content

Commit

Permalink
Merge pull request #11948 from vkuznet/fix-inttest-mspileup
Browse files Browse the repository at this point in the history
Fix last digit wrap in customDID sequence
  • Loading branch information
amaltaro authored Mar 26, 2024
2 parents ce9187c + 6c8e7fb commit db3b432
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/python/WMCore/MicroService/MSPileup/MSPileupData.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def customDID(pname):
if re.match(pat, pname):
arr = pname.split("-")
lastSuffix = arr[-1]
ver = int(lastSuffix[-1])
ver = int(lastSuffix.replace('V', ''))
suffix = f"{ver + 1}"
pname = ''.join(pname[:-1]) + suffix
pname = ''.join(pname.split('-V')[0]) + '-V' + suffix
else:
pname += "-V1"
return pname
Expand Down
12 changes: 12 additions & 0 deletions test/python/WMCore_t/MicroService_t/MSPileup_t/MSPileupData_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def testCustomDID(self):
expect = "/abc/xyz/MINIAOD-V124"
self.assertTrue(did == expect)

# test last digit wrap
pname = "/abc/xyz/MINIAOD-V19"
did = customDID(pname)
expect = "/abc/xyz/MINIAOD-V20"
self.assertTrue(did == expect)

# test last digit wrap
pname = "/abc/xyz/MINIAOD-V99"
did = customDID(pname)
expect = "/abc/xyz/MINIAOD-V100"
self.assertTrue(did == expect)

def testUpdateTransitionRecord(self):
"""Test the addTransitionRecord function"""
self.logger.info("test addTransitionRecord function")
Expand Down

0 comments on commit db3b432

Please sign in to comment.