Enhance shell to handle server error 24/21424/6
authorhalil.cakal <halil.cakal@est.tech>
Fri, 14 Jun 2024 16:28:29 +0000 (17:28 +0100)
committerhalil.cakal <halil.cakal@est.tech>
Mon, 17 Jun 2024 12:47:29 +0000 (13:47 +0100)
- handle error scenarios when the values not being recorded
  into the local-file for any reason
- set x-axis to rotate

Issue-ID: CPS-2244

Change-Id: Iaeab115677c81d5a370e7f9d043aa6ed087a6e6a
Signed-off-by: halil.cakal <halil.cakal@est.tech>
jjb/onap/cps/prepare-k6-performance-tests-plots.sh

index 0d150e5030bf609edb3ba5e9d40b902ce4377526..ce85431db886442f0b2ca58843768585bdfa38c9 100755 (executable)
@@ -136,7 +136,7 @@ getAndRecordDataResults() {
   newLine="$limit_value,$buildNumber,$actual"
   if [ -z "$actual" ]; then
     # No entry found for this build, the default added as zero
-    echo "$limit_value,$buildNumber,0" >>"$dataFile"
+    echo "0,$buildNumber,0" >>"$dataFile"
     recordLatestRecordedBuild "$buildNumber"
   elif [ "$newLine" == "$lastLine" ]; then
     # Entry already exists
@@ -163,7 +163,6 @@ buildPlotImage() {
 
   # Read the first line of the file
   first_line=$(head -n 1 "$dataFile")
-
   # Set upper limit of the graphs to %20 to have more space above the plot
   ten_percent=1.2
   limit=$(echo "$first_line" | cut -d ',' -f 1)
@@ -177,6 +176,7 @@ set output "${chartFileName}"
 set xlabel "Build"
 set ylabel "Limit (ms)"
 set yrange [0 : ${limit} < *]
+set xtics rotate
 plot '$dataFile' using 2:3:xtic(sprintf("%d", column(2))) with linespoints title "measured", \
      '$dataFile' using 2:1 with lines linestyle 2 title "limit"
 EOT
@@ -220,8 +220,8 @@ done
 # Close the HTML file
 cat <<EOT >>"$outputFile"
       </table>
-        <p>The k6 job at 7:15 a.m. once a day, providing performance metrics.</p>
-        <p>The following graphs being updated at 7:45 a.m. once a day.</p>
+        <p>The k6 performance tests runs every hour, providing performance metrics to the plots.</p>
+        <p>The k6 plots is being updated 31 minutes past every hour.</p>
         <p>Successful performance tests job build adds new data, but even if a build fails, existing data is retained.</p>
     </body>
   </html>