guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: tests: Improve metrics testing.


From: Mathieu Othacehe
Subject: branch master updated: tests: Improve metrics testing.
Date: Tue, 15 Sep 2020 11:54:45 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 8fc4794  tests: Improve metrics testing.
8fc4794 is described below

commit 8fc4794b3080944e82610bc8177d0ab7723dfcbd
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Tue Sep 15 17:52:18 2020 +0200

    tests: Improve metrics testing.
    
    * tests/metrics.scm (nearest-exact-integer): Remove as unused.
    ("db-update-metrics"): Test that 'pending-builds metric is updated on
    "db-update-metrics" call.
---
 tests/metrics.scm | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/tests/metrics.scm b/tests/metrics.scm
index 8859084..9b9a29f 100644
--- a/tests/metrics.scm
+++ b/tests/metrics.scm
@@ -23,11 +23,6 @@
              ((guix utils) #:select (call-with-temporary-output-file))
              (srfi srfi-64))
 
-(define (nearest-exact-integer x)
-  "Given a real number X, return the nearest exact integer, with ties going to
-the nearest exact even integer."
-  (inexact->exact (round x)))
-
 (define-syntax-rule (with-temporary-database body ...)
   (call-with-temporary-output-file
    (lambda (file port)
@@ -117,13 +112,15 @@ nix_name, log, status, timestamp, starttime, stoptime) 
VALUES
       (db-update-metric 'percentage-failed-eval-per-spec "guix")
       (db-get-metrics-with-id 'percentage-failed-eval-per-spec)))
 
-  (test-assert "db-update-metrics"
+  (test-equal "db-update-metrics"
+    `((,today . 2.0))
     (begin
+      (sqlite-exec (%db) (format #f "\
+INSERT INTO Builds (id, derivation, evaluation, job_name, system,
+nix_name, log, status, timestamp, starttime, stoptime) VALUES
+(3, '/gnu/store/zzz.drv', 1, '', '', '', '', -2, 0, 0, 0);"))
       (db-update-metrics)
-      (equal? (db-get-metric 'average-10-last-eval-duration-per-spec
-                             "guix")
-              (db-get-metric 'average-100-last-eval-duration-per-spec
-                             "guix"))))
+      (db-get-metrics-with-id 'pending-builds)))
 
   (test-assert "db-close"
     (db-close (%db)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]