Handle when there's no system-test-data to insert
Previously it would error in one of the INSERT queries.
This commit is contained in:
parent
08eb4731d1
commit
fdee09d1c0
1 changed files with 42 additions and 41 deletions
|
|
@ -30,51 +30,52 @@
|
||||||
(define (insert-system-tests-for-guix-revision conn
|
(define (insert-system-tests-for-guix-revision conn
|
||||||
guix-revision-id
|
guix-revision-id
|
||||||
system-test-data)
|
system-test-data)
|
||||||
(let* ((system-test-ids
|
(unless (null? system-test-data)
|
||||||
(insert-missing-data-and-return-all-ids
|
(let* ((system-test-ids
|
||||||
conn
|
(insert-missing-data-and-return-all-ids
|
||||||
"system_tests"
|
conn
|
||||||
'(name description location_id)
|
"system_tests"
|
||||||
(map (match-lambda
|
'(name description location_id)
|
||||||
((name description derivation-file-names-by-system location-data)
|
(map (match-lambda
|
||||||
(list name
|
((name description derivation-file-names-by-system location-data)
|
||||||
description
|
(list name
|
||||||
(location->location-id
|
description
|
||||||
conn
|
(location->location-id
|
||||||
(apply location location-data)))))
|
conn
|
||||||
system-test-data)))
|
(apply location location-data)))))
|
||||||
(data
|
system-test-data)))
|
||||||
(append-map
|
(data
|
||||||
(lambda (system-test-id derivation-file-names-by-system)
|
(append-map
|
||||||
(let ((systems
|
(lambda (system-test-id derivation-file-names-by-system)
|
||||||
(map car derivation-file-names-by-system))
|
(let ((systems
|
||||||
(derivation-ids
|
(map car derivation-file-names-by-system))
|
||||||
(derivation-file-names->derivation-ids
|
(derivation-ids
|
||||||
conn
|
(derivation-file-names->derivation-ids
|
||||||
(map cdr derivation-file-names-by-system))))
|
conn
|
||||||
(map (lambda (system derivation-id)
|
(map cdr derivation-file-names-by-system))))
|
||||||
(list guix-revision-id
|
(map (lambda (system derivation-id)
|
||||||
system-test-id
|
(list guix-revision-id
|
||||||
derivation-id
|
system-test-id
|
||||||
system))
|
derivation-id
|
||||||
systems
|
system))
|
||||||
derivation-ids)))
|
systems
|
||||||
system-test-ids
|
derivation-ids)))
|
||||||
(map third system-test-data))))
|
system-test-ids
|
||||||
|
(map third system-test-data))))
|
||||||
|
|
||||||
(exec-query
|
(exec-query
|
||||||
conn
|
conn
|
||||||
(string-append
|
(string-append
|
||||||
"
|
"
|
||||||
INSERT INTO guix_revision_system_test_derivations
|
INSERT INTO guix_revision_system_test_derivations
|
||||||
(guix_revision_id, system_test_id, derivation_id, system)
|
(guix_revision_id, system_test_id, derivation_id, system)
|
||||||
VALUES "
|
VALUES "
|
||||||
(string-join
|
(string-join
|
||||||
(map (lambda (vals)
|
(map (lambda (vals)
|
||||||
(apply simple-format #f "(~A, ~A, ~A, '~A')"
|
(apply simple-format #f "(~A, ~A, ~A, '~A')"
|
||||||
vals))
|
vals))
|
||||||
data)
|
data)
|
||||||
", "))))
|
", ")))))
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
(define (select-system-tests-for-guix-revision conn
|
(define (select-system-tests-for-guix-revision conn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue