CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
conddbCopyTest.CopyTest Class Reference

Public Member Functions

def __init__ (self, db)
 
def execute (self, sourceTag, baseFile, destTag, synchro, destSince, success, expectedAction)
 
def log (self, msg)
 

Public Attributes

 db
 
 errors
 
 logFileName
 

Detailed Description

Definition at line 47 of file conddbCopyTest.py.

Constructor & Destructor Documentation

def conddbCopyTest.CopyTest.__init__ (   self,
  db 
)

Definition at line 48 of file conddbCopyTest.py.

48  def __init__(self, db):
49  self.db = db
50  self.errors = 0
51  self.logFileName = 'conddbCopyTest.log'
52 

Member Function Documentation

def conddbCopyTest.CopyTest.execute (   self,
  sourceTag,
  baseFile,
  destTag,
  synchro,
  destSince,
  success,
  expectedAction 
)

Definition at line 59 of file conddbCopyTest.py.

References conddbCopyTest.copy(), conddbCopyTest.CopyTest.errors, conddbCopyTest.CopyTest.log(), crabFunctions.CrabTask.log, and conddbCopyTest.CopyTest.logFileName.

59  def execute( self, sourceTag, baseFile, destTag, synchro, destSince, success, expectedAction ):
60  insertedSince = None
61  metaDestFile = '%s.txt' %destTag
62  #shutil.copyfile( baseFile, destFile )
63  self.log( '# ---------------------------------------------------------------------------')
64  self.log( '# Testing tag %s with synch=%s, destSince=%s - expecting ret=%s action=%s' %(destTag,synchro,destSince,success,expectedAction))
65 
66  descr = 'Testing conditionsUpload with synch:%s - expected action: %s' %(synchro,expectedAction)
67  beforeUpload = datetime.datetime.utcnow()
68  ret = copy( sourceTag, destTag, destSince, self.logFileName )
69  if ret != success:
70  self.log( 'ERROR: the return value for the copy of tag %s with sychro %s was %s, while the expected result is %s' %(destTag,synchro,ret,success))
71  self.errors += 1
72  else:
73  row = self.db.getLastInsertedSince( destTag, beforeUpload )
74  if ret == True:
75  if expectedAction == 'CREATE' or expectedAction == 'INSERT' or expectedAction == 'APPEND':
76  if destSince != row[0]:
77  self.log( 'ERROR: the since inserted is %s, expected value is %s - expected action: %s' %(row[0],destSince,expectedAction))
78  self.errors += 1
79  else:
80  self.log( '# OK: Found expected value for last since inserted: %s timestamp: %s' %(row[0],row[1]))
81  insertedSince = row[0]
82  elif expectedAction == 'SYNCHRONIZE':
83  if destSince == row[0]:
84  self.log( 'ERROR: the since inserted %s has not been synchronized with the FCSR - expected action: %s' %(row[0],expectedAction))
85  self.errors += 1
86  else:
87  self.log( '# OK: Found synchronized value for the last since inserted: %s timestamp: %s' %(row[0],row[1]))
88  insertedSince = row[0]
89  else:
90  self.log( 'ERROR: found an appended since %s - expected action: %s' %(row[0],expectedAction))
91  self.errors += 1
92  else:
93  if not row is None:
94  self.log( 'ERROR: found new insered since: %s timestamp: %s' %(row[0],row[1]))
95  self.errors += 1
96  if expectedAction != 'FAIL':
97  self.log( 'ERROR: Upload failed. Expected value: %s' %(destSince))
98  self.errors += 1
99  else:
100  self.log( '# OK: Upload failed as expected.')
101  return insertedSince
102 
103 
def copy(sourceTag, destTag, since, logFileName)
def execute(self, sourceTag, baseFile, destTag, synchro, destSince, success, expectedAction)
def conddbCopyTest.CopyTest.log (   self,
  msg 
)

Definition at line 53 of file conddbCopyTest.py.

References conddbCopyTest.CopyTest.logFileName, and edm.print().

Referenced by conddbCopyTest.CopyTest.execute(), and conditionUploadTest.UploadTest.upload().

53  def log( self, msg ):
54  print(msg)
55  with open(self.logFileName,'a') as logFile:
56  logFile.write(msg)
57  logFile.write('\n')
58 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65

Member Data Documentation

conddbCopyTest.CopyTest.db

Definition at line 49 of file conddbCopyTest.py.

conddbCopyTest.CopyTest.errors
conddbCopyTest.CopyTest.logFileName