get test results into dahsboard : part 1 formatting
This commit is contained in:
+81
-10
@@ -57,7 +57,7 @@ class gDashboard:
|
||||
#worksheet
|
||||
self.sheet = self.ss.worksheet(worksheet)
|
||||
self.ss.del_worksheet(self.sheet) #start by deleting the old sheet
|
||||
self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one
|
||||
self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="30") #create a new one
|
||||
|
||||
self.d = {} #data dictionary
|
||||
|
||||
@@ -78,10 +78,21 @@ class gDashboard:
|
||||
row =[dt_string]
|
||||
self.sheet.insert_row(row, index=1, value_input_option='RAW')
|
||||
|
||||
#line 2 empty
|
||||
#line 2 is for the test names (links to jenkins pipeline), updated at the end
|
||||
|
||||
#line 3 is for the column names
|
||||
i=3
|
||||
row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","Review Form","OK MERGE","Merge conflicts"]
|
||||
|
||||
#test 1
|
||||
row.append("# PASS")
|
||||
row.append("# FAIL")
|
||||
row.append("Last Fail")
|
||||
#test 2
|
||||
row.append("# PASS")
|
||||
row.append("# FAIL")
|
||||
row.append("Last Fail")
|
||||
|
||||
self.sheet.insert_row(row, index=i, value_input_option='RAW')
|
||||
|
||||
#line 4 onward, MR data lines
|
||||
@@ -143,15 +154,29 @@ class gDashboard:
|
||||
found=True
|
||||
n+=1
|
||||
|
||||
#add test results, notice : NSA only for the moment (code to be refactored for multiple tests afterwards)
|
||||
cmd="python3 /home/oaicicd/mysql/sql_connect_dev.py "+str(self.d[x]['iid'])
|
||||
|
||||
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
|
||||
output = process.stdout.readline()
|
||||
|
||||
tmp=output.decode("utf-8")
|
||||
tmp=tmp.replace('\'','"')
|
||||
tmp=tmp.rstrip()
|
||||
testres = json.loads(tmp)
|
||||
|
||||
|
||||
#build final row to be inserted, the first column is left empty for now, will be filled afterward with hyperlinks to gitlab MR
|
||||
row =["", str(date_time_obj.date()),str(self.d[x]['author']['name']),str(self.d[x]['title']),\
|
||||
assignee, reviewer,\
|
||||
milestone1,milestone2,milestone3,review_form,milestone4,conflicts]
|
||||
milestone1,milestone2,milestone3,review_form,milestone4,conflicts,\
|
||||
testres['PASS'],testres['FAIL']]
|
||||
|
||||
|
||||
#insert the row to worksheet
|
||||
self.sheet.insert_row(row, index=i, value_input_option='RAW')
|
||||
|
||||
|
||||
|
||||
|
||||
#add MR hyperlinks in a list of requests to be sent as one update batch; this to save API calls (quotas)
|
||||
i=3
|
||||
@@ -162,10 +187,39 @@ class gDashboard:
|
||||
hyperlink= '\"'+"https://gitlab.eurecom.fr/oai/openairinterface5g/-/merge_requests/"+ str(self.d[x]['iid']) +'\"'
|
||||
text= '\"'+str(self.d[x]['iid'])+'"'
|
||||
requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex))
|
||||
|
||||
cmd="python3 /home/oaicicd/mysql/sql_connect_dev.py "+str(self.d[x]['iid'])
|
||||
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
|
||||
output = process.stdout.readline()
|
||||
tmp=output.decode("utf-8")
|
||||
tmp=tmp.replace('\'','"')
|
||||
tmp=tmp.rstrip()
|
||||
testres = json.loads(tmp)
|
||||
if len(testres['fails list'])>0:
|
||||
colIndex=14
|
||||
hyperlink= '\"'+ testres['fails link'][0] +'\"'
|
||||
text= '\"'+testres['fails list'][0]+'"'
|
||||
requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex))
|
||||
i=i+1
|
||||
body = {"requests": requests}
|
||||
self.ss.batch_update(body)
|
||||
|
||||
#line 2 is for the test names
|
||||
#add MR hyperlinks in a list of requests to be sent as one update batch; this to save API calls (quotas)
|
||||
requests=[]
|
||||
rowIndex=1
|
||||
colIndex=12
|
||||
hyperlink= '\"'+"https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-NSA-Mini-Module/"+'\"'
|
||||
text= '\"'+'NSA Mini'+'"'
|
||||
requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex))
|
||||
rowIndex=1
|
||||
colIndex=15
|
||||
hyperlink= '\"'+"https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-Module/"+'\"'
|
||||
text= '\"'+'NR SA'+'"'
|
||||
requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex))
|
||||
|
||||
body = {"requests": requests}
|
||||
self.ss.batch_update(body)
|
||||
|
||||
|
||||
def addHyperlink(self, hyperlink, text, destinationSheetName, rowIndex, colIndex):
|
||||
@@ -207,17 +261,17 @@ class gDashboard:
|
||||
"copyPaste": {
|
||||
"source": {
|
||||
"sheetId": sourceSheetId,
|
||||
"startRowIndex": 0,
|
||||
"startRowIndex": 1,
|
||||
"endRowIndex": 40,
|
||||
"startColumnIndex": 0,
|
||||
"endColumnIndex": 12
|
||||
"endColumnIndex": 19
|
||||
},
|
||||
"destination": {
|
||||
"sheetId": destinationSheetId,
|
||||
"startRowIndex": 0,
|
||||
"startRowIndex": 1,
|
||||
"endRowIndex": 40,
|
||||
"startColumnIndex": 0,
|
||||
"endColumnIndex": 12
|
||||
"endColumnIndex": 19
|
||||
},
|
||||
"pasteType": "PASTE_FORMAT"
|
||||
}
|
||||
@@ -280,9 +334,26 @@ class gDashboard:
|
||||
}
|
||||
)
|
||||
|
||||
body = {"requests": requests}
|
||||
self.ss.batch_update(body)
|
||||
|
||||
#group MR related columns
|
||||
# sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId']
|
||||
# requests.append(
|
||||
# {
|
||||
# "addDimensionGroup": {
|
||||
# "range": {
|
||||
# "dimension": "COLUMNS",
|
||||
# "sheetId": sheetId,
|
||||
# "startIndex": 3,
|
||||
# "endIndex": 12
|
||||
# },
|
||||
# }
|
||||
# }
|
||||
# )
|
||||
#
|
||||
body = {"requests": requests}
|
||||
self.ss.batch_update(body)
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
LTE-2x2 : #short name used in the dashboard
|
||||
job : 'RAN-LTE-2x2-Module-OAIEPC' #job name from Jenkins, used in the database
|
||||
link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-LTE-2x2-Module-OAIEPC'
|
||||
NSA-B200 :
|
||||
job : 'RAN-NSA-B200-Module-LTEBOX'
|
||||
link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-NSA-B200-Module-LTEBOX'
|
||||
NSA-2x2 :
|
||||
job : 'RAN-NSA-2x2-Module-OAIEPC'
|
||||
link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-NSA-2x2-Module-OAIEPC'
|
||||
SA-N310 :
|
||||
job : 'RAN-SA-Module-CN5G'
|
||||
link : 'https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-Module-CN5G'
|
||||
Reference in New Issue
Block a user