me
/
guix
Archived
1
0
Fork 0

tests: Ensure 'cpan' updater test does not access the network.

Previously it would try to access the real metacpan.org.  This would
succeed when network is available because "Test-Script" is an existing
package.

* tests/cpan.scm ("package-latest-release"): Wrap
'upstream-source-inputs' call in 'parameterize'.  Set
'current-http-proxy'.  Change the order of responses in
'with-http-server'.
master
Ludovic Courtès 2023-06-09 12:09:12 +02:00
parent df8b3821a8
commit f69d14d31a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 13 additions and 12 deletions

View File

@ -102,21 +102,22 @@
(downstream-name "perl-test-script") (downstream-name "perl-test-script")
(type 'propagated)))) (type 'propagated))))
(with-http-server `((200 ,test-json) (with-http-server `((200 ,test-json)
(200 ,test-source) (200 "{ \"distribution\" : \"Test-Script\" }")
(200 "{ \"distribution\" : \"Test-Script\" }")) (200 ,test-source))
(parameterize ((%metacpan-base-url (%local-url))
(current-http-proxy (%local-url)))
(define source (define source
(parameterize ((%metacpan-base-url (%local-url)))
(package-latest-release (package-latest-release
(dummy-package "perl-test-script" (dummy-package "perl-test-script"
(version "0.0.0") (version "0.0.0")
(source (dummy-origin (source (dummy-origin
(method url-fetch) (method url-fetch)
(uri "mirror://cpan/Foo-Bar-0.0.0.tgz")))) (uri "mirror://cpan/Foo-Bar-0.0.0.tgz"))))
(list %cpan-updater)))) (list %cpan-updater)))
(list (upstream-source-urls source) (list (upstream-source-urls source)
(upstream-source-signature-urls source) (upstream-source-signature-urls source)
(upstream-source-inputs source)))) (upstream-source-inputs source)))))
(test-equal "metacpan-url->mirror-url, http" (test-equal "metacpan-url->mirror-url, http"
"mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz" "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"