diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2023-06-08 22:43:05 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-06-08 22:54:58 +0200 |
| commit | 885d524f79aa4bbfac5dfebf285e1e248184ee70 (patch) | |
| tree | e48cdf6f498d2c95fad985d58436d4fb19f3e532 /tests/substitute.scm | |
| parent | 3f5e14182931f123c10513a3e1e2abaebfb52279 (diff) | |
substitute: Gracefully retry after failed partial downloads.
Fixes <https://issues.guix.gnu.org/63443>.
Reported by Attila Lendvai <attila@lendvai.name>.
* guix/scripts/substitute.scm (catch-system-error): New macro.
(download-nar): Add call to 'delete-file-recursively'.
* tests/substitute.scm ("substitute, previous partial download around"):
New test.
Diffstat (limited to 'tests/substitute.scm')
| -rw-r--r-- | tests/substitute.scm | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/substitute.scm b/tests/substitute.scm index 8df3938b591..7246ed82d51 100644 --- a/tests/substitute.scm +++ b/tests/substitute.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> | 2 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> |
| 3 | ;;; Copyright © 2014-2015, 2017-2019, 2021-2022 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2014-2015, 2017-2019, 2021-2023 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; | 6 | ;;; |
| @@ -639,6 +639,29 @@ System: mips64el-linux\n"))) | |||
| 639 | (lambda () | 639 | (lambda () |
| 640 | (false-if-exception (delete-file "substitute-retrieved"))))))) | 640 | (false-if-exception (delete-file "substitute-retrieved"))))))) |
| 641 | 641 | ||
| 642 | (test-equal "substitute, previous partial download around" | ||
| 643 | "Substitutable data." | ||
| 644 | (with-narinfo* (string-append %narinfo "Signature: " (signature-field %narinfo)) | ||
| 645 | %main-substitute-directory | ||
| 646 | |||
| 647 | (with-http-server `((200 ,(string-append %narinfo "Signature: " | ||
| 648 | (signature-field %narinfo))) | ||
| 649 | (200 ,(call-with-input-file | ||
| 650 | (string-append %main-substitute-directory | ||
| 651 | "/example.nar") | ||
| 652 | get-bytevector-all))) | ||
| 653 | (dynamic-wind | ||
| 654 | (const #t) | ||
| 655 | (lambda () | ||
| 656 | (parameterize ((substitute-urls (list (%local-url)))) | ||
| 657 | (mkdir-p "substitute-retrieved/a/b/c/d") ;add stale data | ||
| 658 | (request-substitution (string-append (%store-prefix) | ||
| 659 | "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") | ||
| 660 | "substitute-retrieved")) | ||
| 661 | (call-with-input-file "substitute-retrieved" get-string-all)) | ||
| 662 | (lambda () | ||
| 663 | (false-if-exception (delete-file "substitute-retrieved"))))))) | ||
| 664 | |||
| 642 | (test-quit "substitute, narinfo is available but nar is missing" | 665 | (test-quit "substitute, narinfo is available but nar is missing" |
| 643 | "failed to find alternative substitute" | 666 | "failed to find alternative substitute" |
| 644 | (with-narinfo* | 667 | (with-narinfo* |
