From f23ee71ea7efedd14843a474f87550d7d991cca7 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 18 Nov 2019 19:49:12 +0000 Subject: Insert channel news entries when loading new guix revisions If the channel-news-for-commit function is present. --- tests/jobs-load-new-guix-revision.scm | 48 ++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/jobs-load-new-guix-revision.scm b/tests/jobs-load-new-guix-revision.scm index 8f82e10..9f7b32f 100644 --- a/tests/jobs-load-new-guix-revision.scm +++ b/tests/jobs-load-new-guix-revision.scm @@ -14,6 +14,8 @@ (with-postgresql-connection "test-jobs-load-new-guix-revision" (lambda (conn) + (exec-query conn "TRUNCATE guix_revisions CASCADE") + (test-equal "select-job-for-commit works" '() (select-job-for-commit conn "does not exist")) @@ -29,17 +31,24 @@ (mock ((guix-data-service jobs load-new-guix-revision) extract-information-from - (lambda (conn git-repository-id commit store-path) + (lambda (conn guix-revision-id commit store-path) #t)) - (match (enqueue-load-new-guix-revision-job - conn - (git-repository-url->git-repository-id conn "test-url") - "test-commit" - "test-source") - ((id) - (process-load-new-guix-revision-job id)))))) - + (mock + ((guix channels) + channel-news-for-commit + (lambda (channel commit) + '())) + + (match (enqueue-load-new-guix-revision-job + conn + (git-repository-url->git-repository-id conn "test-url") + "test-commit" + "test-source") + ((id) + (process-load-new-guix-revision-job id))))))) + + (exec-query conn "TRUNCATE guix_revisions CASCADE") (exec-query conn "TRUNCATE load_new_guix_revision_jobs CASCADE") (test-equal "test build store item failure" @@ -74,13 +83,19 @@ (lambda (conn git-repository-id commit store-path) #f)) - (match (enqueue-load-new-guix-revision-job - conn - (git-repository-url->git-repository-id conn "test-url") - "test-commit" - "test-source") - ((id) - (process-load-new-guix-revision-job id)))))) + (mock + ((guix channels) + channel-news-for-commit + (lambda (channel commit) + '())) + + (match (enqueue-load-new-guix-revision-job + conn + (git-repository-url->git-repository-id conn "test-url") + "test-commit" + "test-source") + ((id) + (process-load-new-guix-revision-job id))))))) (exec-query conn "TRUNCATE load_new_guix_revision_jobs CASCADE") @@ -101,5 +116,4 @@ #t) #:always-rollback? #t)))) - (test-end) -- cgit v1.2.3