[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/08: tests: cgit: Add a file to the test repository.
From: |
Ludovic Courtès |
Subject: |
05/08: tests: cgit: Add a file to the test repository. |
Date: |
Tue, 28 Nov 2017 17:36:32 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit e755692bc1795382b2f91fc9763a690c02899954
Author: Ludovic Courtès <address@hidden>
Date: Tue Nov 28 22:41:57 2017 +0100
tests: cgit: Add a file to the test repository.
* gnu/tests/version-control.scm (README-contents): New variable.
(%make-git-repository): Add a 'README' file to the repo.
(%test-repository-service): New variable.
(%cgit-os): Use it.
(run-cgit-test): Test /test/tree/README and /test/tree/does-not-exist.
---
gnu/tests/version-control.scm | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 5a3937c..405b786 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -30,14 +30,38 @@
#:use-module (gnu packages version-control)
#:use-module (guix gexp)
#:use-module (guix store)
+ #:use-module (guix modules)
#:export (%test-cgit))
+(define README-contents
+ "Hello! This is what goes inside the 'README' file.")
+
(define %make-git-repository
;; Create Git repository in /srv/git/test.
- #~(begin
- (mkdir-p "/srv/git/test")
- (system* (string-append #$git "/bin/git") "-C" "/srv/git/test"
- "init" "--bare")))
+ (with-imported-modules (source-module-closure
+ '((guix build utils)))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let ((git (string-append #$git "/bin/git")))
+ (mkdir-p "/tmp/test-repo")
+ (with-directory-excursion "/tmp/test-repo"
+ (call-with-output-file "/tmp/test-repo/README"
+ (lambda (port)
+ (display #$README-contents port)))
+ (invoke git "config" "--global" "user.email" "address@hidden")
+ (invoke git "config" "--global" "user.name" "A U Thor")
+ (invoke git "init")
+ (invoke git "add" ".")
+ (invoke git "commit" "-m" "That's a commit."))
+
+ (mkdir-p "/srv/git")
+ (rename-file "/tmp/test-repo/.git" "/srv/git/test")))))
+
+(define %test-repository-service
+ ;; Service that creates /srv/git/test.
+ (simple-service 'make-git-repository activation-service-type
+ %make-git-repository))
(define %cgit-configuration-nginx
(list
@@ -68,8 +92,7 @@
(service cgit-service-type
(cgit-configuration
(nginx %cgit-configuration-nginx)))
- (simple-service 'make-git-repository activation-service-type
- %make-git-repository))))
+ %test-repository-service)))
(operating-system
(inherit base-os)
(packages (cons* git
@@ -161,7 +184,9 @@ HTTP-PORT."
(test-url "/test")
(test-url "/test/log")
(test-url "/test/tree")
+ (test-url "/test/tree/README")
(test-url "/test/does-not-exist" 404)
+ (test-url "/test/tree/does-not-exist" 404)
(test-url "/does-not-exist" 404))
(test-end)
- branch master updated (20d2c6e -> 3af03e5), Ludovic Courtès, 2017/11/28
- 05/08: tests: cgit: Add a file to the test repository.,
Ludovic Courtès <=
- 06/08: tests: Add 'git-http' test., Ludovic Courtès, 2017/11/28
- 08/08: services: certbot: Add default value and description., Ludovic Courtès, 2017/11/28
- 07/08: services: cgit, git-daemon: Add description and default value., Ludovic Courtès, 2017/11/28
- 02/08: services: Add certbot service., Ludovic Courtès, 2017/11/28
- 04/08: services: Add Git HTTP(S) service support., Ludovic Courtès, 2017/11/28
- 01/08: build: Add missing patch., Ludovic Courtès, 2017/11/28
- 03/08: doc: Create "Version Control Services" section., Ludovic Courtès, 2017/11/28