CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
conddbCopyTest.CopyTest Class Reference

Public Member Functions

def __init__
 
def execute
 
def log
 

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 
49  def __init__(self, db):
50  self.db = db
51  self.errors = 0
52  self.logFileName = 'conddbCopyTest.log'

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(), o2olib.O2ORun.log, cond::persistency::Logger.log(), cond::CredentialStore.log(), crabFunctions.CrabTask.log, and conddbCopyTest.CopyTest.logFileName.

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

Definition at line 53 of file conddbCopyTest.py.

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

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

53 
54  def log( self, msg ):
55  print(msg)
56  with open(self.logFileName,'a') as logFile:
57  logFile.write(msg)
58  logFile.write('\n')
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

conddbCopyTest.CopyTest.db

Definition at line 49 of file conddbCopyTest.py.

conddbCopyTest.CopyTest.errors

Definition at line 50 of file conddbCopyTest.py.

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

conddbCopyTest.CopyTest.logFileName

Definition at line 51 of file conddbCopyTest.py.

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